Re: [PATCH] phabricator: better error message when phabread fails to get a differential
On Sun, 24 Mar 2019 19:24:12 -0400, Jordi GutiƩrrez Hermoso wrote: > # HG changeset patch > # User Laurent Peuch > # Date 1553469818 14400 > # Sun Mar 24 19:23:38 2019 -0400 > # Node ID a39d18493bf66aa29f7d0dc1c5a4164b84507e1b > # Parent ba064f95175e6cb1467401a3a536d8c32229d4b1 > phabricator: better error message when phabread fails to get a differential > > diff --git a/hgext/phabricator.py b/hgext/phabricator.py > --- a/hgext/phabricator.py > +++ b/hgext/phabricator.py > @@ -783,8 +783,9 @@ def querydrev(repo, spec): > prefetched[drev[b'phid']] = drev > prefetched[int(drev[b'id'])] = drev > if key not in prefetched: > -raise error.Abort(_(b'cannot get Differential Revision %r') > - % params) > +raise error.Abort(_(b'cannot get Differential Revision %s using > the params %r.' > + % (key, params)), stringutil.pprint()? Otherwise, py3 would print b''. > + hint=_("check that the Differential Revision > exists and that you have access to it")) test-check-code.t would say hi. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] phabricator: better error message when phabread fails to get a differential
# HG changeset patch # User Laurent Peuch # Date 1553469818 14400 # Sun Mar 24 19:23:38 2019 -0400 # Node ID a39d18493bf66aa29f7d0dc1c5a4164b84507e1b # Parent ba064f95175e6cb1467401a3a536d8c32229d4b1 phabricator: better error message when phabread fails to get a differential diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -783,8 +783,9 @@ def querydrev(repo, spec): prefetched[drev[b'phid']] = drev prefetched[int(drev[b'id'])] = drev if key not in prefetched: -raise error.Abort(_(b'cannot get Differential Revision %r') - % params) +raise error.Abort(_(b'cannot get Differential Revision %s using the params %r.' + % (key, params)), + hint=_("check that the Differential Revision exists and that you have access to it")) return prefetched[key] def getstack(topdrevids): diff --git a/tests/test-phabricator.t b/tests/test-phabricator.t --- a/tests/test-phabricator.t +++ b/tests/test-phabricator.t @@ -28,6 +28,9 @@ this test. $ hg phabread --config auth.hgphab.phabtoken=cli-notavalidtoken \ > --test-vcr "$VCR/phabread-conduit-error.json" D4480 | head abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-notavalidtoken" has the wrong length. API tokens should be 32 characters long. + $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4481 | head + abort: cannot get Differential Revision 4481 using the params {'ids': [4481]}. + (check that the Differential Revision exists and that you have access to it) Basic phabread: $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel