6

I'm looking at a doxygen code example and seeing the following.

/**  
  @file test.h  
  @brief Define helper functions  
  $Id: test.h,v 1.10 2012/10/10 10:10:10 author Exp $  
*/ 

Can anyone explain what does $Id: do here?

Thanks

Ben Jackson
  • 90,079
  • 9
  • 98
  • 150
elgnoh
  • 493
  • 5
  • 15
  • Hmm. That `,v` looks suspiciously like a CVS file identifier. I haven't used CVS for years and years though, so I don't have any repositories left to check! Have a look at the top of [this file](ftp://ftp-glast.slac.stanford.edu/glast.u05/src/CMX/cmt/cmx_doxygen.pl) for a similar example. – Rook Nov 12 '12 at 18:17
  • 3
    That is a version control id, CVS, SVN or other. The version control mechanism would automatically update that information when you commit some changes. It isn't specific to doxygen either. – juanchopanza Nov 12 '12 at 18:19

1 Answers1

10

That's not a doxygen line at all. That's a source-control command character telling it to substitute in version information so you can see in the source which committed version you're working with. See http://www.badgertronics.com/writings/cvs/keywords.html

Mark B
  • 95,107
  • 10
  • 109
  • 188
  • So do I add '$Id: $' before I import my files into repository? Thanks – elgnoh Nov 12 '12 at 18:37
  • 1
    The `$Id: $` syntax is used by RCS, CVS, and (optionally) SVN. Yes, you add `$Id: $`, or just `$Id$`, to your source file before checking it in; checking it out automatically expands it. – Keith Thompson Nov 12 '12 at 20:44
  • You may also have to manually tell the source control system to do keyword substitution in order for it to place this information in the tag. e.g. for SVN see (http://wiki.preshweb.co.uk/doku.php?id=svn:propset)[http://wiki.preshweb.co.uk/doku.php?id=svn:propset] something like "svn propset svn:keywords 'Id' test.h" You can also set it up in the [auto-props] section of your .subversion/config file to atutomatically add this property to new files, with lines like "*.h = svn:keywords=Id" – Captain Lepton May 02 '13 at 12:05