Reputation: 11
As part of a script I'm writing, I'm trying to grab the latest revision number within a given branch in SVN.
I had tried the following code (where ${sourcebranch} is the SVN URL for my branch):
svn info ${sourcebranch} | awk '/Revision/ { print $2; }'
However, this seems to give me the latest revision number for the entire repository, not just the branch.
I really just want the branch... any ideas?
Upvotes: 1
Views: 442
Reputation: 5298
"Revision" value is applied to whole repo, you need "Last changed rev".
Upvotes: 2
Reputation: 23747
Use log
instead:
svn log --limit 1 ${sourcebranch}
This will return the last commit to the branch, similar to this output:
------------------------------------------------------------------------ r14159 | author_name | 2014-04-25 18:54:49 -0400 (Fri, 25 Apr 2014) | 5 lines log message ------------------------------------------------------------------------
From there, just parse the r####
field.
Upvotes: 2