Akki
Akki

Reputation: 11

Subversion (SVN) Checkout using batch file

I am using svn checkout command in a batch file to checkout the my source code folder from SVN and then build the code.

But sometimes checkout fails and thus code build fails as all the folders are not checkedout. So how would one come to know whether checkout has failed so that i can restart the checkout process.

Upvotes: 1

Views: 2588

Answers (1)

Joey
Joey

Reputation: 354396

svn should exit with a non-zero exit code if something failed, so

svn checkout ...
if errorlevel 1 (
  echo something failed
)

To build something more robust that simply tries the checkout until it succeeds you can use something like this:

:l
rem reset errorlevel to 0
ver > nul
if exist foo rd /s /q foo > nul
svn checkout http://... foo || goto l

which should try until success.

Upvotes: 3

Related Questions