[PATCH 2 of 2] pull: makes hg returns 255 value on updates failure (issue4948)

Yuya Nishihara yuya at tcha.org
Mon Nov 16 06:15:00 CST 2015


On Sun, 15 Nov 2015 23:05:59 +0100, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1447624708 -3600
> #      Sun Nov 15 22:58:28 2015 +0100
> # Node ID 3023a2e6071e6e07d56409198141f2d359458d20
> # Parent  893a8b3e5a71e33fd003982dbb3b549fc4b04ef1
> pull: makes hg returns 255 value on updates failure (issue4948)

This should be flagged as "(BC)".

> Before this patch hg pull -u on UpdateAbort error returned
> 0 value to the system. This patch fixes this returning 255 -
> same value as separate update would return. Function postincoming
> is returning -1 because same values is returned in case of
> case error when UpdateAbort is catched in dispatch._runcatch(this
> function is catching this error in analogic situation when update
> fails running in separate pull + update). Returned value -1 is
> translated to 255 error code in dispatch.run function.
> 
> diff -r 893a8b3e5a71 -r 3023a2e6071e mercurial/commands.py
> --- a/mercurial/commands.py	Sun Nov 15 22:18:48 2015 +0100
> +++ b/mercurial/commands.py	Sun Nov 15 22:58:28 2015 +0100
> @@ -5230,7 +5230,7 @@
>              ui.warn(_("not updating: %s\n") % str(inst))
>              if inst.hint:
>                  ui.warn(_("(%s)\n") % inst.hint)
> -            return 0
> +            return -1

If the error code is 255, we can just raise Abort(_("not updating: %s") ...).


More information about the Mercurial-devel mailing list