Page 1 of 1

Subversion expansion tag

PostPosted: 06 Aug 2013, 01:22
by spr
There is a very useful expansion tag I have noticed in the code -

Code: Select all
 * @version $Id: CardFactoryUtil.java 22806 2013-08-05 18:02:21Z Sloth $
I added it to some new code I recently committed as "@version $Id$" but it does not seem to have expanded. If someone can confirm what the correct syntax is that would be awesome!

Cheers,
Steve

Re: Subversion expansion tag

PostPosted: 06 Aug 2013, 01:44
by friarsol
I believe it's $Id:

Re: Subversion expansion tag

PostPosted: 06 Aug 2013, 18:11
by spr
friarsol wrote:I believe it's $Id:
Nope. Tried "$Id:" and "$Id:$". Remains resolutely unexpanded. :?

Cheers,
Steve

Re: Subversion expansion tag

PostPosted: 06 Aug 2013, 18:26
by friarsol
spr wrote:
friarsol wrote:I believe it's $Id:
Nope. Tried "$Id:" and "$Id:$". Remains resolutely unexpanded. :?
It only expands when you commit, and you need to make sure the files have their svn:keywords set appropriately for that file.

http://svnbook.red-bean.com/en/1.4/svn. ... words.html

You do need the ending $ as well.

Re: Subversion expansion tag

PostPosted: 06 Aug 2013, 18:44
by spr
Thanks for the link. I just assumed it would be some server setting but it looks like I will need to run the following for each file I want substitution to take place in. I will give it a go next time I commit.

Code: Select all
svn propset svn:keywords "Id" <filename>.java

EDIT: and for this to work <filename>.java must have been checked into subversion at least once. It will fail if the file does not yet exist in subversion.
EDIT: and it works! Finally! :D
EDIT: just to confirm the tag is "$Id:$".

Cheers,
Steve