views:

69

answers:

3

I've seen it everywhere. In documentation, web sites, help screens, you name it.
Why?
Should I use it too?
How?

+1  A: 

That is probably an expanded version of '$Id$', which I think has its origins with the RCS version control system, and has been inherited or implemented in many others, not least CVS and SVN.

Basically, you stick '$Id$' into your source code somewhere, and the version control system expands it to an identity string containing the current revision on every checkout.

Then, when looking at source code you can remind yourself which revision or branch the source code has come from.

Personally I do not find it that useful.

Here is the CVS documentation for keyword substitution: http://ximbiot.com/cvs/manual/cvs-1.11.6/cvs_12.html

Note that $Id$ is one of many such strings that can be used.

jmtd
...one of those strings being $Revision$...
Jon Bright
+3  A: 

The tag is probably from CVS and represents the version of that file in CVS. The developer inserts $Revision$ in his code. When it's committed, CVS expands this to $Revision: 1.2.3$. In my opinion, you definitely shouldn't use it or its friends (such as $Id$), at least in normal source code.

If you have a more modern source control system (SVN, Mercurial, git, monotone) which has a single version number for the whole tree, then keeping a file somewhere in your build that contains that number isn't a bad thing - it lets you do things such as in the bottom right of this page, where right now it says "svn revision: 3772".

But if you have something like CVS, where each file has its own separate version numbers, you end up with $Revision$ (or $Id$ or whatever) in each file. Over time, this causes confusion (people quoting version numbers that only refer to one file, for example) and leads to merge errors where there might otherwise have been a clean merge (remote version has a different version of that line than your local version, merger trips up).

Plus, anything programmatically and automatically changing your source code should be viewed with suspicion.

Jon Bright
A: 

Why?

It's an attempt to answer the question "Which version of the source code matches the binaries shipped to a customer?" How it works others have commented on.

Should I use it too?
How?

Do you need it? How often have you or your developers asked that question? How often have you had difficulty answering it? If you already have tags/branches like release-1.0, release-1.1 etc., then you most likely don't need it.

pgs