This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Automatically adding version number to the code

Is there any method/technique/feature to add automatically incremented build number to the code (managed by software or tool)?
the build number can be used for viewing (hence traceability of the code).

Parents
  • I totally fail to understand what mean there - your pointers do point to something, since they aren't NULL pointers. Even uninitialized pointers point to something. And for most architectures, NULL pointers also points to something.

    In your case, they point to text strings with the contents your source file specifies. The text "$WCREV$" must be stored somewhere in memory. It's just a question of used compiler, architecture and compiler flags if the text will be copied to RAM somewhere or if the pointer will point to a text string in the code segment.

    The intention with the above strings is that the source file can be scanned and have these magic tags modified to also contain extra information.

    Let's say a source file contains
    // $Id: $

    Then a source code manager can update the above to instead contain:
    // $Id: main.c,v 1.33 2013/05/24 11:23:19 pwm Exp $

    The above is an example of tag expansion by CVS, but almost all serious versioning systems do support this kind of tag expansion.

    But what source code management operations have you performed, to trig your version control system to process your file and update these tags?

Reply
  • I totally fail to understand what mean there - your pointers do point to something, since they aren't NULL pointers. Even uninitialized pointers point to something. And for most architectures, NULL pointers also points to something.

    In your case, they point to text strings with the contents your source file specifies. The text "$WCREV$" must be stored somewhere in memory. It's just a question of used compiler, architecture and compiler flags if the text will be copied to RAM somewhere or if the pointer will point to a text string in the code segment.

    The intention with the above strings is that the source file can be scanned and have these magic tags modified to also contain extra information.

    Let's say a source file contains
    // $Id: $

    Then a source code manager can update the above to instead contain:
    // $Id: main.c,v 1.33 2013/05/24 11:23:19 pwm Exp $

    The above is an example of tag expansion by CVS, but almost all serious versioning systems do support this kind of tag expansion.

    But what source code management operations have you performed, to trig your version control system to process your file and update these tags?

Children
  • But what source code management operations have you performed,
    i am using tortoise svn to manage revisions.

    to trig your version control system to process your file and update these tags?
    Nothing. I dont know (even a bit about) how to do that. Refer a good post or article if you can. (till then continue searching)

  • Was Reading the chapter5 of help, i executed a command line in the command prompt of windows.
    SubWCRev D:\MyLPC1788\Codes\Development Board\Local D:\MyLPC1788\Codes\Development Board\version.h D:\MyLPC1788\Codes\Development Board -nmdfe

    But the nothing change in the version.h file. So i went to the (right click) Properties->new->keywords and checked the boxes "Author, Date, ID, Revision"
    Again executed the line in the command prompt but no updates.

  • I created a text file (template.txt) and updated

    // Test file for SubWCRev
    
    char *Revision      = "$WCREV$";
    char *Revision16    = "$WCREV&0xFF$";
    char *Revisionp100  = "$WCREV+100$";
    char *Revisionm100  = "$WCREV-100$";
    char *Modified      = "$WCMODS?Modified:Not modified$";
    char *Unversioned   = "$WCUNVER?Unversioned items found:no unversioned items$";
    char *Date          = "$WCDATE$";
    ...                            // as given on the site
    
    #if $WCMODS?1:0$
    #error Source is modified
    #endif
    


    then saved it as .tmpl file.

    SubWCRev D:\MyLPC1788\Codes\Development Board\Local D:\MyLPC1788\Codes\Development Board\template.tmpl D:\MyLPC1788\Codes\Development Board\version.h -nmdfe

    But the nothing change in the version.h file. So i changed the name to version.txt but no updates.
    What is the mistake that i am committing?

  • What is the mistake that i am committing?

    Did you try to figure it out yourself?
    First of all, do you actually need all those command line switches: "-nmdfe"? I don't think they mean what you think they mean. And I don't think you actually need them.
    Second, you really should enclose file paths in quotes. Those spaces in directory names can easily create problems.

  • What is the mistake that i am committing?

    Did you try to figure it out yourself?
    First of all, do you actually need all those command line switches: "-nmdfe"? Do you understand what they mean? Because I don't think you need them.
    Secondly, you really should enclose file paths in quotes. Those spaces in directory names can easily create problems.

  • Thank you. Double inverted commas got me the required output.

  • Secondly, you really should enclose file paths in quotes. Those spaces in directory names can easily create problems.

    Or better yet, one should really just not use spaces in file and directory names. They simply aren't worth the grief they routinely cause. Blanks in filenames just don't mix well with command-line oriented tools like compilers.


  • Absolutely!

    (and, of course, "filenames" includes folder names)