Checking hg exit code in Windows batch
Jan Vrany
jan.vrany at fit.cvut.cz
Tue Jul 8 08:48:48 UTC 2014
Hi,
I tried with 3.0.1 and same result.
Funny enough, I tried on another Win 7 machine (almost the same setup)
and there it works.
I don't really understand why is that. But apparently the problem is not
only in mercurial but rather some combination of OS, DLLs, hell knows what.
Sorry, I should have tried that before posting here.
Jan
On 07/07/14 19:42, Jérôme Godbout wrote:
> Hi, I tried with mercurial 3.0.1, it worked for me
> c:\MyProject> hg update
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>
> c:\MyProject> echo %ERRORLEVEL%
> 0
>
> c:\MyProject> hg update -r toto123
> abort: unknown revision 'toto123'!
>
> c:\MyProject> echo %ERRORLEVEL%
> 255
>
> You may want to update to 3.0.1 or above to solve your problem. Haven't
> try into a batch.
> Jerome Godbout
>
>
>
> On Mon, Jul 7, 2014 at 12:24 PM, Jan Vrany <jan.vrany at fit.cvut.cz
> <mailto:jan.vrany at fit.cvut.cz>> wrote:
>
> Hi there,
>
> I'm struggling to check exit code og hg command on Windows.
> I have a .bat file doing something like
>
> hg --cwd %PKGDIR% update -r %REVISION%
> IF [%ERRORLEVEL%] NEQ [0] (
> ECHO Cannot update working copy in %PKGDIR%
> GOTO error
> )
>
> but it seems that %ERRORLEVEL% is always 0, even if revision is
> completely bogus. I tried following in Windows 'Command Prompt':
>
> H:\Projects\someproject>hg update -r bogus
> abort: unknown revision 'bogus'!
>
> H:\Projects\someproject>>echo %errorlevel%
> 0
>
> i.e., same result, I got 0. On Linux it works as I would expect
> (getting 255). The system is Win 7 64 bit box with Mercurial 2.9.2
> installed from .msi package downloaded from selenic.
>
> Any idea what I'm doing wrong?
> Thanks a lot.
>
> Best, Jan
> _________________________________________________
> Mercurial mailing list
> Mercurial at selenic.com <mailto:Mercurial at selenic.com>
> http://selenic.com/mailman/__listinfo/mercurial
> <http://selenic.com/mailman/listinfo/mercurial>
>
>
More information about the Mercurial
mailing list