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

liscju piotr.listkiewicz at gmail.com
Sun Nov 15 16:05:59 CST 2015


# 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)

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 not ret and not checkout:
             if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
                 ui.status(_("updating bookmark %s\n") % repo._activebookmark)
diff -r 893a8b3e5a71 -r 3023a2e6071e tests/test-pull-update.t
--- a/tests/test-pull-update.t	Sun Nov 15 22:18:48 2015 +0100
+++ b/tests/test-pull-update.t	Sun Nov 15 22:58:28 2015 +0100
@@ -27,6 +27,7 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   not updating: not a linear update
   (merge or update --check to force update)
+  [255]
 
   $ cd ../tt
 
@@ -41,6 +42,7 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   not updating: not a linear update
   (merge or update --check to force update)
+  [255]
 
   $ HGMERGE=true hg merge
   merging foo


More information about the Mercurial-devel mailing list