views:

844

answers:

4

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.

+3  A: 

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.

macbirdie
+2  A: 

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.

gbjbaanb
A: 

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$

Leonel
If you change just one file, do you REALLY want all other files to be changed as well? Even if that fix only fixes a typo in some comment? That's crazy! I would never want that feature in MY svn...
Paulius Maruška
I only want a few files to be changed after a commit, and those are the ones where I have placed the $GlobalRev$ keyword, and for which the (yet nonexistant) svn:global_rev property has been set.Being able to look at a running application and tell which *exact* SVN revision it was compiled from is priceless.
Leonel
+1  A: 

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