6

I just want a single file, called "revision", which contains the repository revision number at any given time so that when I export my repository, my application is able to see which revision it was.

How can I do this?

Fragsworth
  • 33,919
  • 27
  • 84
  • 97

3 Answers3

3

The problem with using normal Keyword Substitution is that $rev$ only shows the last revision in which that file changed. I haven't tried it myself, but there is a tool called svnversion that comes with SVN that I believe you can use to get the revision number of the working copy. It's then just a case of configuring your build process to use this tool and insert the result into your revision file.

There is a good guide on how to use svnversion (especially if you're using ANT) here: http://cameronstokes.com/2009/12/12/using-svnversion-from-ant

Paul Walker
  • 2,698
  • 4
  • 20
  • 20
0

I suppose you could do something using pre-commit hook, but I don't really know if that's such a great idea.

Why don't you version your app on its own? (and eg. put version number in the commit comment) Wouldn't that be a simpler solution?

What is more svn revision numbers are given one by one no matter what branch it's being committed to - is this ok for you?

kubal5003
  • 7,186
  • 8
  • 52
  • 90
0

Try checking this out. We used to do this with CVS.

http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html

Dave G
  • 9,639
  • 36
  • 41
  • Normal keyword substitution won't work as it only shows when that file was last updated. Half way down the page, in the yellow box called "Where's $GlobalRev$?", it explains why and mentions "svnversion" - this is what you need. – Paul Walker Feb 06 '11 at 01:07