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

liscju piotr.listkiewicz at gmail.com
Mon Nov 16 22:06:56 UTC 2015


# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1447624708 -3600
#      Sun Nov 15 22:58:28 2015 +0100
# Node ID 7b1d4670d629b08cb72928974a3f398ee53f22d6
# Parent  2da6a2dbfc42bdec4bcaf47da947c64ff959a59c
pull: makes hg returns 255 value on updates failure (issue4948) (BC)

Before this patch hg pull -u on UpdateAbort error returned
0 value to the system. This patch fixes this by reraising
UpdateAbort with updated error msg.

diff -r 2da6a2dbfc42 -r 7b1d4670d629 mercurial/commands.py
--- a/mercurial/commands.py	Mon Nov 09 17:20:50 2015 -0500
+++ b/mercurial/commands.py	Sun Nov 15 22:58:28 2015 +0100
@@ -5227,10 +5227,9 @@
                 checkout, movemarkfrom, brev = updata
             ret = hg.update(repo, checkout)
         except error.UpdateAbort as inst:
-            ui.warn(_("not updating: %s\n") % str(inst))
-            if inst.hint:
-                ui.warn(_("(%s)\n") % inst.hint)
-            return 0
+            msg = _("not updating: %s") % str(inst)
+            hint = inst.hint
+            raise error.UpdateAbort(msg, hint=hint)
         if not ret and not checkout:
             if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
                 ui.status(_("updating bookmark %s\n") % repo._activebookmark)
diff -r 2da6a2dbfc42 -r 7b1d4670d629 tests/test-pull-update.t
--- a/tests/test-pull-update.t	Mon Nov 09 17:20:50 2015 -0500
+++ b/tests/test-pull-update.t	Sun Nov 15 22:58:28 2015 +0100
@@ -25,8 +25,9 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
-  not updating: not a linear update
+  abort: not updating: not a linear update
   (merge or update --check to force update)
+  [255]
 
   $ cd ../tt
 
@@ -39,8 +40,9 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
-  not updating: not a linear update
+  abort: 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