merge with stable
authorAugie Fackler <augie@google.com>
Mon, 04 May 2020 10:06:53 -0400
changeset 44860 cfe86fbc722e
parent 44859 16cba0ad8ac2 (current diff)
parent 44761 ee0790b67c45 (diff)
child 44861 83c97c0bd319
merge with stable
--- a/.hgsigs	Fri May 01 08:07:25 2020 -0700
+++ b/.hgsigs	Mon May 04 10:06:53 2020 -0400
@@ -195,3 +195,4 @@
 6d121acbb82e65fe4dd3c2318a1b61981b958492 0 iQJEBAABCAAuFiEEK8zhT1xnJaouqK63ucncgkqlvdUFAl5f3IEQHHJhZkBkdXJpbjQyLmNvbQAKCRC5ydyCSqW91WoeD/9qhywGg/TI/FJEeJN5bJjcpB/YQeYDWCHh69yUmMPenf+6CaV/3QPc3R8JyQSKWwGUwc0IgZiJBb/HoUvBzpQyTvmGqddWsIGBpdGAkbLmRrE5BakR7Shs987a3Oq4hB03DJD4sQ1VitWg2OvGNd8rl1kSIF8aIErVI6ZiSw5eYemc/1VyBJXHWSFmcfnQqdsyPppH9e9/TAhio+YP4EmLmoxUcyRSb3UbtO2NT9+DEADaex+H2l9evg7AkTieVd6N163uqsLJIxSfCh5ZVmzaGW6uEoyC4U+9bkAyVE3Cy5z2giYblBzUkO9xqEZoA4tOM+b+gHokY8Sq3iGVw046CIW5+FjU9B5+7hCqWThYjnpnt+RomtHxrkqQ9SSHYnEWb4YTHqs+J7lWbm3ErjF08hYOyMA9/VT47UAKw4XL4Ss/1Pr7YezdmwB4jn7dqvslNvTqRAUOzB/15YeCfbd23SL4YzGaKBs9ajkxFFeCNNpLQ8CRm3a7/K6qkYyfSUpgUX7xBmRQTvUgr3nVk1epH/kOKwryy94Z+nlHF0qEMEq+1QOa5yvt3Kkr4H03pOFbLhdpjID5IYP4rRQTKB9yOS3XWBCE63AQVc7uuaBGPMCSLaKRAFDUXWY7GzCqda88WeN5BFC5iHrQTYE1IQ5YaWu38QMsJt2HHVc27+BuLA==
 8fca7e8449a847e3cf1054f2c07b51237699fad3 0 iQJEBAABCAAuFi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FYTr8dF3bSsAT9fuaLNV6tI2ofbRLXh0gFXYdaWu10eVRrSMUMiH7n3H6EpzLa4sNdyFrK0vU4aSTlBERcjj2rj86dY0XQQL181V7Yhg8m8nyj+BzraRh7et2UXNsVosOnbTa1XX0qFVu+qAVp2BeqC4k31jm0MJk+1pDzkuAPs07z3ITwkDmTHjzxm5qoZyZ1/n37BB6miD+8xJYNH7vBX/yrDW790HbloasQOcXcerNR
--- a/.hgtags	Fri May 01 08:07:25 2020 -0700
+++ b/.hgtags	Mon May 04 10:06:53 2020 -0400
@@ -208,3 +208,4 @@
 6d121acbb82e65fe4dd3c2318a1b61981b958492 5.3.1
 8fca7e8449a847e3cf1054f2c07b51237699fad3 5.3.2
 26ce8e7515036d3431a03aaeb7bc72dd96cb1112 5.4rc0
+cf3e07d7648a4371ce584d15dd692e7a6845792f 5.4
--- a/hgext/phabricator.py	Fri May 01 08:07:25 2020 -0700
+++ b/hgext/phabricator.py	Mon May 04 10:06:53 2020 -0400
@@ -1307,6 +1307,26 @@
     if any(c for c in ctxs if c.obsolete()):
         raise error.Abort(_(b"obsolete commits cannot be posted for review"))
 
+    # Ensure the local commits are an unbroken range.  The semantics of the
+    # --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]
+        raise error.Abort(
+            _(b"cannot phabsend multiple %s revisions: %s")
+            % (revtype, scmutil.nodesummaries(repo, badnodes)),
+            hint=_(b"the revisions must form a linear chain"),
+        )
+
+    heads = repo.revs(b'heads(%ld)', revs)
+    if len(heads) > 1:
+        _fail_nonlinear_revs(heads, heads.max(), b"head")
+
+    roots = repo.revs(b'roots(%ld)', revs)
+    if len(roots) > 1:
+        _fail_nonlinear_revs(roots, roots.min(), b"root")
+
     fold = opts.get(b'fold')
     if fold:
         if len(revs) == 1:
@@ -1322,13 +1342,6 @@
         if not opts.get(b"amend"):
             raise error.Abort(_(b"cannot fold with --no-amend"))
 
-        # Ensure the local commits are an unbroken range
-        revrange = repo.revs(b'(first(%ld)::last(%ld))', revs, revs)
-        if any(r for r in revs if r not in revrange) or any(
-            r for r in revrange if r not in revs
-        ):
-            raise error.Abort(_(b"cannot fold non-linear revisions"))
-
         # It might be possible to bucketize the revisions by the DREV value, and
         # iterate over those groups when posting, and then again when amending.
         # But for simplicity, require all selected revisions to be for the same
--- a/tests/test-phabricator.t	Fri May 01 08:07:25 2020 -0700
+++ b/tests/test-phabricator.t	Mon May 04 10:06:53 2020 -0400
@@ -181,7 +181,7 @@
   1849d7828727 mapped to old nodes ['1849d7828727']
   D7919 - skipped - 1849d7828727: create comment for phabricator test
 
-Phabsend doesn't create an instability when rebasing existing revisions on top
+Phabsend doesn't create an instability when restacking existing revisions on top
 of new revisions.
 
   $ hg init reorder
@@ -589,6 +589,13 @@
   applying patch from D7917
   applying patch from D7918
 
+Phabsend requires a linear range of commits
+
+  $ hg phabsend -r 0+2+3
+  abort: cannot phabsend multiple head revisions: c44b38f24a45
+  (the revisions must form a linear chain)
+  [255]
+
 Validate arguments with --fold
 
   $ hg phabsend --fold -r 1
@@ -597,9 +604,6 @@
   $ hg phabsend --fold --no-amend -r 1::
   abort: cannot fold with --no-amend
   [255]
-  $ hg phabsend --fold -r 0+3
-  abort: cannot fold non-linear revisions
-  [255]
   $ hg phabsend --fold -r 1::
   abort: cannot fold revisions with different DREV values
   [255]