phabricator: clarify the multiple heads/roots error message for phabsend
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 16 Jul 2020 14:16:53 -0400
changeset 45152 b3b0cd8b9366
parent 45151 e429e7c801b2
child 45153 8b6a446508c2
phabricator: clarify the multiple heads/roots error message for phabsend As pointed out in followup feedback for c1c922391314, it's confusing to say there are multiple items and then only list one. Differential Revision: https://phab.mercurial-scm.org/D8761
hgext/phabricator.py
tests/test-phabricator.t
--- a/hgext/phabricator.py	Tue Jul 14 13:35:54 2020 -0700
+++ b/hgext/phabricator.py	Thu Jul 16 14:16:53 2020 -0400
@@ -1311,8 +1311,8 @@
     # --fold option implies this, and the auto restacking of orphans requires
     # it.  Otherwise A+C in A->B->C will cause B to be orphaned, and C' to
     # get A' as a parent.
-    def _fail_nonlinear_revs(revs, skiprev, revtype):
-        badnodes = [repo[r].node() for r in revs if r != skiprev]
+    def _fail_nonlinear_revs(revs, revtype):
+        badnodes = [repo[r].node() for r in revs]
         raise error.Abort(
             _(b"cannot phabsend multiple %s revisions: %s")
             % (revtype, scmutil.nodesummaries(repo, badnodes)),
@@ -1321,11 +1321,11 @@
 
     heads = repo.revs(b'heads(%ld)', revs)
     if len(heads) > 1:
-        _fail_nonlinear_revs(heads, heads.max(), b"head")
+        _fail_nonlinear_revs(heads, b"head")
 
     roots = repo.revs(b'roots(%ld)', revs)
     if len(roots) > 1:
-        _fail_nonlinear_revs(roots, roots.min(), b"root")
+        _fail_nonlinear_revs(roots, b"root")
 
     fold = opts.get(b'fold')
     if fold:
--- a/tests/test-phabricator.t	Tue Jul 14 13:35:54 2020 -0700
+++ b/tests/test-phabricator.t	Thu Jul 16 14:16:53 2020 -0400
@@ -596,7 +596,7 @@
 Phabsend requires a linear range of commits
 
   $ hg phabsend -r 0+2+3
-  abort: cannot phabsend multiple head revisions: c44b38f24a45
+  abort: cannot phabsend multiple head revisions: c44b38f24a45 aaef04066140
   (the revisions must form a linear chain)
   [255]