##// END OF EJS Templates
phabricator: ensure that `phabsend` is given a contiguous, linear commit range...
Matt Harbison -
r45281:c1c92239 stable
parent child Browse files
Show More
@@ -1307,6 +1307,26 b' def phabsend(ui, repo, *revs, **opts):'
1307 1307 if any(c for c in ctxs if c.obsolete()):
1308 1308 raise error.Abort(_(b"obsolete commits cannot be posted for review"))
1309 1309
1310 # Ensure the local commits are an unbroken range. The semantics of the
1311 # --fold option implies this, and the auto restacking of orphans requires
1312 # it. Otherwise A+C in A->B->C will cause B to be orphaned, and C' to
1313 # get A' as a parent.
1314 def _fail_nonlinear_revs(revs, skiprev, revtype):
1315 badnodes = [repo[r].node() for r in revs if r != skiprev]
1316 raise error.Abort(
1317 _(b"cannot phabsend multiple %s revisions: %s")
1318 % (revtype, scmutil.nodesummaries(repo, badnodes)),
1319 hint=_(b"the revisions must form a linear chain"),
1320 )
1321
1322 heads = repo.revs(b'heads(%ld)', revs)
1323 if len(heads) > 1:
1324 _fail_nonlinear_revs(heads, heads.max(), b"head")
1325
1326 roots = repo.revs(b'roots(%ld)', revs)
1327 if len(roots) > 1:
1328 _fail_nonlinear_revs(roots, roots.min(), b"root")
1329
1310 1330 fold = opts.get(b'fold')
1311 1331 if fold:
1312 1332 if len(revs) == 1:
@@ -1322,13 +1342,6 b' def phabsend(ui, repo, *revs, **opts):'
1322 1342 if not opts.get(b"amend"):
1323 1343 raise error.Abort(_(b"cannot fold with --no-amend"))
1324 1344
1325 # Ensure the local commits are an unbroken range
1326 revrange = repo.revs(b'(first(%ld)::last(%ld))', revs, revs)
1327 if any(r for r in revs if r not in revrange) or any(
1328 r for r in revrange if r not in revs
1329 ):
1330 raise error.Abort(_(b"cannot fold non-linear revisions"))
1331
1332 1345 # It might be possible to bucketize the revisions by the DREV value, and
1333 1346 # iterate over those groups when posting, and then again when amending.
1334 1347 # But for simplicity, require all selected revisions to be for the same
@@ -589,6 +589,13 b' Phabimport accepts multiple DREVSPECs'
589 589 applying patch from D7917
590 590 applying patch from D7918
591 591
592 Phabsend requires a linear range of commits
593
594 $ hg phabsend -r 0+2+3
595 abort: cannot phabsend multiple head revisions: c44b38f24a45
596 (the revisions must form a linear chain)
597 [255]
598
592 599 Validate arguments with --fold
593 600
594 601 $ hg phabsend --fold -r 1
@@ -597,9 +604,6 b' Validate arguments with --fold'
597 604 $ hg phabsend --fold --no-amend -r 1::
598 605 abort: cannot fold with --no-amend
599 606 [255]
600 $ hg phabsend --fold -r 0+3
601 abort: cannot fold non-linear revisions
602 [255]
603 607 $ hg phabsend --fold -r 1::
604 608 abort: cannot fold revisions with different DREV values
605 609 [255]
General Comments 0
You need to be logged in to leave comments. Login now