Patchwork [1,of,7,stable] bundle2: keep hint close to the primary message when remote abort

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 10, 2017, 5:53 p.m.
Message ID <a7ded180ddb35dfc0e64.1486749182@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18400/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Pierre-Yves David - Feb. 10, 2017, 5:53 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1486745807 -3600
#      Fri Feb 10 17:56:47 2017 +0100
# Branch stable
# Node ID a7ded180ddb35dfc0e642e960a59ed475fd9be75
# Parent  af3b5aa61fc05a124697809bf472a5592f38489c
# EXP-Topic getbundleerror
bundle2: keep hint close to the primary message when remote abort

The remote hint message was ignored when reporting the remote error and
passed to the local generic abort error. I think I might initially have
tried to avoid reimplementing logic controlling the hint display depending of
the verbosity level. However, first, there does not seems to have such verbosity
related logic and second the resulting was wrong as the primary error and the
hint were split apart. We now properly print the hint as remote output.

Patch

diff -r af3b5aa61fc0 -r a7ded180ddb3 mercurial/exchange.py
--- a/mercurial/exchange.py	Sat Feb 04 20:29:34 2017 +0800
+++ b/mercurial/exchange.py	Fri Feb 10 17:56:47 2017 +0100
@@ -904,7 +904,9 @@ 
             raise error.Abort(_('missing support for %s') % exc)
         except bundle2.AbortFromPart as exc:
             pushop.ui.status(_('remote: %s\n') % exc)
-            raise error.Abort(_('push failed on remote'), hint=exc.hint)
+            if exc.hint is not None:
+                pushop.ui.status(_('remote: %s\n') % ('(%s)' % exc.hint))
+            raise error.Abort(_('push failed on remote'))
     except error.PushkeyFailed as exc:
         partid = int(exc.partid)
         if partid not in pushop.pkfailcb:
diff -r af3b5aa61fc0 -r a7ded180ddb3 tests/test-bundle2-exchange.t
--- a/tests/test-bundle2-exchange.t	Sat Feb 04 20:29:34 2017 +0800
+++ b/tests/test-bundle2-exchange.t	Fri Feb 10 17:56:47 2017 +0100
@@ -518,16 +518,16 @@ 
   pushing to ssh://user@dummy/other
   searching for changes
   remote: Abandon ship!
+  remote: (don't panic)
   abort: push failed on remote
-  (don't panic)
   [255]
 
   $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
   pushing to http://localhost:$HGPORT2/
   searching for changes
   remote: Abandon ship!
+  remote: (don't panic)
   abort: push failed on remote
-  (don't panic)
   [255]