I'm trying to get the revision information for the head using this command line
svn info https://myserver/branches/Code_Improvements -rHEAD | find "Revision"
However, this returns Revision : 1234
Since I'm using the result of the svn info command to set a variable in my batch file, is there a way I can get just the number 1234, instead of response Revision : 1234.
To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.
Locate TortoiseSVN and click on it. Select "Change" from the options available. Refer to this image for further steps. After completion of the command line client tools, open a command prompt and type svn help to check the successful install.
To get an overview of your changes, use the svn status command. You may use svn status more than any other Subversion command. If you run svn status at the top of your working copy with no arguments, it detects all file and tree changes you've made.
Update Subversion client to 1.9 and use new --show-item
option:
svn info --show-item=revision URL-to-repository.
As an alternative, you can get the XMLed output of svn info
using --xml
option and use PowerShell to get the revision number. Here is a simple example:
[xml]$revnum = svn info <REPOSITORY-URL> --xml -r HEAD
$latestrevnum = $revnum.info.entry.revision
$latestrevnum
For the sake of completeness, if you need to get svn revision and then set it into a variable in a batch file (Windows):
FOR /f "delims=" %%R in ('svn info --show-item=revision URL-to-repository') do @set svnRevision=%%R
echo SVN revision: %svnRevision%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With