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

Piotr Listkiewicz piotr.listkiewicz at gmail.com
Mon Nov 16 06:25:44 CST 2015


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


The only problem with raising abort is that it changed output of command
from:

not updating: not a linear update
(merge or update --check to force update)

to:

abort: not updating: not a linear update
(merge or update --check to force update)

I thought about solution with raising exception(update command raise
UpdateAbort in same situation) but i have no idea if this minor output
change can be accepted

BTW: Sorry Yuya for sending twice same message , i forgot to add
mercurial-devel in email recipient....


2015-11-16 13:15 GMT+01:00 Yuya Nishihara <yuya at tcha.org>:

> 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")
> ...).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20151116/277b54f6/attachment.html>


More information about the Mercurial-devel mailing list