Harvey
Harvey

Reputation: 5821

Howto determine if an SVN working copy needs updating (from a script)?

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.

Upvotes: 3

Views: 1773

Answers (1)

William Leara
William Leara

Reputation: 10687

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%.

Upvotes: 4

Related Questions