5
votes

I'm trying to figure out, how to get the current SVN repository version but with no luck.

When I try with:

svn info -r BASE

I get following information:

Path: foo-svn
URL: file:///home/hsz/Project/foo-svn
Relative URL: ^/
Repository Root: file:///home/hsz/Project/foo-svn
Repository UUID: b5555486-2e29-45ed-a0bb-b925095964a9
Revision: 10
Node Kind: directory
Last Changed Author: hsz
Last Changed Rev: 10
Last Changed Date: 2015-05-28 11:26:50 +0200 (Thu, 28 May 2015)

So there is a lot useless information around it. Also it varies depending on the machine language (english can be forced prepending command with LANG=en_US).

But the real problem is when I commit something. The output of:

svn commit -m "foo"

is:

Committed revision 11.

But svn info still shows information about the revision 10. After updating the project it is the valid version.

Is there any way to obtain the current real version number without updating the whole project ?

edit more complex example:

  • User A calls svn update and gets the latest version of the project: r10,
  • User A commits new change which is noted as r11,
  • User B updates the project and commits next change: r12,
  • User A needs to know if there is any changes in the repository without updating the project, so he calls:

    svn log BASE:HEAD

but it shows too much output:

r10
r11
r12

instead of:

r11
r12

because BASE is r10 instead of r11 which was HIS last commit.

Is it possible to get the number of the CURRENT revision in the local copy ? In this case, after the update and commit it is r11.

Only svn command is supported and no svn update allowed.

2

2 Answers

3
votes
2
votes

To get the latest revision number of your repo without updating local copy first, use -r HEAD:

svn info -r HEAD