Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detect svn changes in a .bat

Tags:

svn

I have a .bat and inside the .bat i would like to execute a special code if there's some modification inside the svn repository (for example, compile).

like image 405
acemtp Avatar asked Oct 03 '08 11:10

acemtp


1 Answers

For Win 2000 and later, this would assign the last output row from the svn status commmand to the svnOut variable and then test if the variable contains anything:

@echo off
set svnOut=
set svnDir=C:Your\path\to\svn\dir\to\check
for /F "tokens=*" %%I in ('svn status %svnDir%') do set svnOut=%%I

if "%svnOut%"==""  (
    echo No changes
) else (
    echo Changed files!
)

Why there is a line like this

set svnOut=

you have to figure out yourself. ;-)

like image 55
Tooony Avatar answered Oct 10 '22 23:10

Tooony