I'm trying to write a batch file in which I need the HEAD revision of the project I am working on.
Is there a command to get this from the command line?
I am on a Windows XP Machine.
EDIT I ended up using a mix between Shambulator, mizipzor, and Stefan's answers. I ended up with this:
for /f "tokens=5" %%i in ('SubWCRev WorkingCopyPath^|find "Last committed at revision"') do set version=%%i
echo %version%
Thanks for all your help guys
Added this answer to the list below as well.
It's awkward without the text-processing capabilities of *nix, but this batch file does it:
@echo off
for /f "tokens=2" %%i in ('svn info -rHEAD svn://localhost^|find "Revision"') do @echo %%i
Substitute your svn repository for my svn://localhost.
svn info gets the repository info, then pipes it to find, which strips out everything except the line containing the revision number. The for command gives you the second "token" on that line (the first one is Revision:).
EDIT: As others have mentioned already, you'll need a command-line version of Subversion installed, and have svn.exe on your PATH.
If you need that revision in a file, use SubWCRev which is installed with TortoiseSVN (or available separately).
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