views:

51

answers:

1

I'd like to determine from a batch file on Windows if a local SVN working copy needs to be updated from the server. On a unix-like machine, I would run "svn status -u" and count the '*'s. How do I achieve the same thing in a batch file?

Background: I'm trying to determine if a dependency library is out-of-date since it takes a long time to re-build it and we only update it about once every 3 months. This is for an automated build process.

+2  A: 

If I'm following you, maybe something like:

svn st -u | find "*"
if not "%errorlevel%"=="0" goto end

svn update

:end

find sets errorlevel to 0 if it successfully found "*".

EDIT: accidentally left off the "" around %errorlevel%.

William Leara
That will do, I'll just kick anyone who creates a filename containing a '*'.
Harvey
Note I accidentally left off the "" around %errorlevel%.
William Leara
I actually used `if not errorlevel 1 goto do_build` instead. (My logic is inverted from yours.)
Harvey