# HG changeset patch # User Siddharth Agarwal <s...@fb.com> # Date 1491349293 25200 # Tue Apr 04 16:41:33 2017 -0700 # Node ID f31d776ec35686693b3521c07a61ade94e567b9a # Parent 5c84da513a5ff56a973a89631f266c6fcf9b18cd bundle2: use bundleerrorparts for error parts with unbounded parameters
Clients do not know how to read these error parts yet -- that's why they will only be able to print out truncated messages. In the next diff we'll be able to provide the full message. diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -1033,18 +1033,17 @@ def unbundle(repo, proto, heads): if exc.ret is not None: part.addparam('ret', exc.ret, mandatory=False) except error.BundleValueError as exc: - errpart = bundler.newpart('error:unsupportedcontent') + errpart = bundler.newerrorpart('error:unsupportedcontent') if exc.parttype is not None: - errpart.addparam('parttype', exc.parttype) + errpart.addlongparam('parttype', exc.parttype) if exc.params: - errpart.addparam('params', '\0'.join(exc.params)) + errpart.addlongparam('params', '\0'.join(exc.params)) except error.Abort as exc: - manargs = [('message', str(exc))] - advargs = [] + part = bundler.newerrorpart('error:abort') + part.addlongparam('message', str(exc)) if exc.hint is not None: - advargs.append(('hint', exc.hint)) - bundler.addpart(bundle2.bundlepart('error:abort', - manargs, advargs)) + part.addlongparam('hint', exc.hint, mandatory=False) except error.PushRaced as exc: - bundler.newpart('error:pushraced', [('message', str(exc))]) + part = bundler.newerrorpart('error:pushraced') + part.addlongparam('message', str(exc)) return streamres(gen=bundler.getchunks()) diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t --- a/tests/test-bundle2-exchange.t +++ b/tests/test-bundle2-exchange.t @@ -462,6 +462,8 @@ Setting up > part = None > if reason == 'abort': > bundler.newpart('test:abort') + > if reason == 'abort-long': + > bundler.newpart('test:abort-long') > if reason == 'unknown': > bundler.newpart('test:unknown') > if reason == 'race': @@ -472,6 +474,12 @@ Setting up > def handleabort(op, part): > raise error.Abort('Abandon ship!', hint="don't panic") > + > @bundle2.parthandler("test:abort-long") + > def handleabortlong(op, part): + > # Make sure error messages are more than 4k long to ensure they work + > # across payload chunks + > raise error.Abort('a' * 8192, hint="don't panic") + > > def uisetup(ui): > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart > exchange.b2partsgenorder.insert(0, 'failpart') @@ -530,6 +538,20 @@ Doing the actual push: Abort error abort: push failed on remote [255] +Doing the actual push: Abort error (message too long to fit in a param) + + $ cat << EOF >> $HGRCPATH + > [failpush] + > reason = abort-long + > EOF + + $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 + pushing to ssh://user@dummy/other + searching for changes + remote: (a){252}... (re) + remote: (don't panic) + abort: push failed on remote + [255] Doing the actual push: unknown mandatory parts _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel