Hi all, I am a mercurial user on windows and I am trying to write a batch file to check for incoming changes to a number of repositories stored in a common folder (i.e. there could be 10 or so small mercurial repos under a main folder). I have the following batch file that successfully iterates through the multiple repositories and runs hg incoming. However I can't seem to get it to execute hg -pull -u when a repository is found that has remote changes.
   FOR /D /r %%G in (".hg*") DO (
    @echo Processing: %%G
    cd /d %%G\.. 
    hg incoming
    IF NOT ERRORLEVEL 0 (
     echo Pulling changes from the server
     hg pull -u
    )
    cd..
    )
I am pretty sure the problem lies with the If statement. hg incoming doesn't seem to have a return value that can be interpreted by the ERRORLEVEL. Is this the right approach or should I be using python instead?