6

I've seen in several projects that developers include something like $Revision$ in source code documentation. I think they are macros or environment variables for some tool but I do not know how to work with them.

I am interested on adding this feature to my next project. I normally use TextMate, git and doxygen. Any suggestions?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
elitalon
  • 9,191
  • 10
  • 50
  • 86

2 Answers2

10

Yes: suggestion: don't do it.
Keyword expansion could be done with gitattribute filter, as presented in "Git equivalent of subversion's $URL$ keyword expansion", but this introduce metadata within the data, which usually makes merge much more complex that they actually are.

You can see in this (lengthy) answer on "What are the basic clearcase concepts every developer should know?" the all debate on "Embedded Version Numbers - Good or Evil?".
Unless you have a good merge manager in order to ignore those special values, you get a "Merge Hell".
And with Git, as detailed in "How does Git solve the merging problem?", the merge is quite basic. No fancy merge manager.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • God - yes! that is what scm is for.. knowing the last time a file was modified. Metadata must not be mixed with data. The NSA can explain this problem :-) – Pat Jun 13 '13 at 19:03
  • @Pat I see what you did here ;) If I parse your last comment through the *prism* of the actuality, its meaning is quite clear. – VonC Jun 13 '13 at 19:36
  • 2
    The purpose of including the revision in code is to track the source of the code after it is published. This is more important then having to manually merge one file. This "don't do it" answer is a typical case where someone thinks a tool is more important than its purpose.. – QT-1 Jul 29 '19 at 11:00
1

$Revision:$ (the ':' is required) is used by RCS and CVS. Some other systems have similar features, but it seems that the more modern ones do not.

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631