top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why does `svnversion -c` give me a range?

+3 votes
505 views

I would like to include the svn revision number in my project's version info but I am confused by the results of svnversion. I want the version number of a tagged tree to always be the same (i.e. the last commit to the tag) but if the tag is to be rebuilt using a fresh checkout some time later svnversion seems to report the HEAD revision. So I looked at svnversion -c but this always seems to give me a range e.g. 2:1476, even directly after an update.

posted Dec 4, 2013 by Sanketi Garg

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
If you are on windows you can use SubWCRev which is distributed with tortoiseSVN. It is designed to do what you want.

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev.html

1 Answer

+2 votes

I think the -c option means: given all the item in this directory and recursive subdirectories, give the oldest and newest changed file. So, the oldest item in your working copy was last changed in revision 2, and the newest was last changed in revision 1476.

And svnversion without any flag does seem to give the latest revision to which the working copy was updated, not the last changed revision.

If you want the last changed revision, you could use:

svn info | sed -n 's/^Last Changed Rev: //p'
answer Dec 4, 2013 by Luv Kumar
Note that "bare" svnversion can give a range as well:

 % svnversion -c ~srv/conf
 105:143
 % svnversion ~srv/conf
 142:143

FWIW, all this should be documented in 'svnversion --help'. Is it clear there?
Similar Questions
0 votes

Is there a way to detect that current directory is the root of SVN repository by reading files into .svn directory ? I think "svn info" could be used for that. Problem is that some machines may not have access to "svn" command line (if using tortoise and svn is not in command PATH for example).

In case "svn info" (or any other command line) is the only way, what would be the proper way to do it ?

0 votes

I was handed a dump file by a 3rd party and I am supposed to analyze it. I've got it loaded and can look at the log and do all the usual things without any apparent errors. But I notice that some revision numbers are missing.

How can this be?

+1 vote

My most recent commit was the creation of a tag. I want to delete that tag. Should I reverse merge the commit or simply delete the tag?

If I do a reverse merge I see a tree conflict:

C:>svn merge -c -69  

--- Reverse-merging r69 into '.': 

 C tagsTAG_ 

--- Recording mergeinfo for reverse merge of r69 into '.': 

U . 

Tree conflict on 'tagsTAG_ 

 > local dir edit, incoming dir delete upon merge 

Select: (r) mark resolved, (p) postpone, (q) quit resolution, (h) help: 

What is the best thing to do here?

...