Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check current SVN repository version

Tags:

svn

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.

like image 275
hsz Avatar asked May 28 '15 09:05

hsz


People also ask

How do I find my svn repository version?

Try svnversion -c . You can also run svn update and check the last line that always says At revision REVNUM .

What is svn version?

Subversion is used for maintaining current and historical versions of projects. Subversion is an open source centralized version control system. It's licensed under Apache. It's also referred to as a software version and revisioning control system.

How do I know if svn is installed?

SVN Installation To check whether it is installed or not use following command. If Subversion client is not installed, then command will report error, otherwise it will display the version of the installed software. If you are using RPM-based GNU/Linux, then use yum command for installation.

What is svn update command?

The SVN update Command. The svn update command lets you refresh your locally checked out repository with any changes in the repository HEAD on the server. It also tells you what has been changed, added, deleted. If a change has been made to a file you have also changed locally, svn will try to merge those changes.


2 Answers

  • Updates and commits in Subversion are separate! That's why svn info shows 10 after you commit.

  • I guess that you actually want to use svnversion tool. Try svnversion -c.

  • You can also run svn update and check the last line that always says At revision REVNUM.

like image 171
bahrep Avatar answered Sep 30 '22 05:09

bahrep


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

svn info -r HEAD
like image 32
Ivan Jovović Avatar answered Sep 30 '22 06:09

Ivan Jovović