How do I use global revision number keyword with TortoiseSVN?

4.9k Views Asked by At

In CVS you can use keywords in your code that are expanded when checking the files out. I'd like to display the global revision as CVS has with the $GlobalRev$ keyword.

Subversion has the $Rev$ command but it only shows the latest revision that the file was changed. I know there is a svnversion command that has as of right now no documentation what so ever in 1.5 and 1.6 nightly.

I'm interested to know how to do this with TortoiseSVN.

4

There are 4 best solutions below

0
On BEST ANSWER

svnversion is still available, and is documented in 1.5

svnversion is a program for summarizing the revision mixture of a working copy. The resultant revision number, or revision range, is written to standard output.

Use this to get the revision of your working copy after you've checked it out, the documentation for KeywordExpansion describes how its designed to be used.

0
On

I don't think there's an option to have the same thing as in CVS, at least I couldn't find any when I needed that.

Instead I use TortoiseSVN's SubWCRev.exe to turn a template file containing a $WCREV$ string into one with the current revision number.

2
On

My 2 cents:

I'm currently working on a web-based Java application. We have a build server (Hudson) which does not have access to the command-line subversion executable; instead, it ships with a pure-java Subversion library, to be able to access the repo before pulling the sources to build the app.

Now we needed the build process to include the global revision number in the app home page (pretty much like StackOverflow does, if you look at the bottom-right corner of your screen).

Unfortunately there are no good integrations between Subversion and Ant. The best one, SVNAnt, is more targeted at using the command line svn.exe and has given us quite some trouble to run.

In the end, it took me two hours to use SVNKit, which is a pure-java library for Subversion access, to tweak our build script to look at the revision number and insert it in our files.

Personally, I can't see what's so hard about creating a variable, say, $GlobalRev$ that you would insert in each file, just like you do with $Id$ or $Rev$

0
On

I understand the above remark. but it seems that globalrev could be usefull in one case...

when you want in all running executable to have the version of the last build.

for sample, if you put in a versionning.propriety file one propriety with the title of the application, you could add the version number.

so when tester or user remark problems they coul compare the number with the release not to see if the functionality is there. this variable $GlobalRev$ will be use in a small context but could be usefull.

Regards