Patchwork [6,of,7,stable] getbundle: cleanly handle remote abort during getbundle

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 10, 2017, 5:53 p.m.
Message ID <3b13a645b703c0eab4eb.1486749187@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18403/
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 1486747040 -3600
#      Fri Feb 10 18:17:20 2017 +0100
# Branch stable
# Node ID 3b13a645b703c0eab4eb6cf73a19a1886fb6eab8
# Parent  fcb3f4f9e1f60459e13588a66861ab50835a09e9
# EXP-Topic getbundleerror
getbundle: cleanly handle remote abort during getbundle

bundle2 allow the server to report error explicitly. This was initially
implemented for push but there is not reason to not use it for pull too. This
changeset add logic similar to the one in 'unbundle' to the
client side of 'getbundle'. That logic make sure the error is properly reported
as "remote". This will allow the server side of getbundle to send clean "Abort"
message in the next changeset.

Patch

diff -r fcb3f4f9e1f6 -r 3b13a645b703 mercurial/exchange.py
--- a/mercurial/exchange.py	Fri Feb 10 18:06:08 2017 +0100
+++ b/mercurial/exchange.py	Fri Feb 10 18:17:20 2017 +0100
@@ -1363,6 +1363,9 @@ 
     bundle = pullop.remote.getbundle('pull', **kwargs)
     try:
         op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
+    except bundle2.AbortFromPart as exc:
+        pullop.repo.ui.status(_('remote: abort: %s\n') % exc)
+        raise error.Abort(_('pull failed on remote'), hint=exc.hint)
     except error.BundleValueError as exc:
         raise error.Abort(_('missing support for %s') % exc)