hgext/phabricator.py
changeset 45152 b3b0cd8b9366
parent 45140 c59e7bed8924
child 45272 b1f2659c1c34
equal deleted inserted replaced
45151:e429e7c801b2 45152:b3b0cd8b9366
  1309 
  1309 
  1310     # Ensure the local commits are an unbroken range.  The semantics of the
  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
  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
  1312     # it.  Otherwise A+C in A->B->C will cause B to be orphaned, and C' to
  1313     # get A' as a parent.
  1313     # get A' as a parent.
  1314     def _fail_nonlinear_revs(revs, skiprev, revtype):
  1314     def _fail_nonlinear_revs(revs, revtype):
  1315         badnodes = [repo[r].node() for r in revs if r != skiprev]
  1315         badnodes = [repo[r].node() for r in revs]
  1316         raise error.Abort(
  1316         raise error.Abort(
  1317             _(b"cannot phabsend multiple %s revisions: %s")
  1317             _(b"cannot phabsend multiple %s revisions: %s")
  1318             % (revtype, scmutil.nodesummaries(repo, badnodes)),
  1318             % (revtype, scmutil.nodesummaries(repo, badnodes)),
  1319             hint=_(b"the revisions must form a linear chain"),
  1319             hint=_(b"the revisions must form a linear chain"),
  1320         )
  1320         )
  1321 
  1321 
  1322     heads = repo.revs(b'heads(%ld)', revs)
  1322     heads = repo.revs(b'heads(%ld)', revs)
  1323     if len(heads) > 1:
  1323     if len(heads) > 1:
  1324         _fail_nonlinear_revs(heads, heads.max(), b"head")
  1324         _fail_nonlinear_revs(heads, b"head")
  1325 
  1325 
  1326     roots = repo.revs(b'roots(%ld)', revs)
  1326     roots = repo.revs(b'roots(%ld)', revs)
  1327     if len(roots) > 1:
  1327     if len(roots) > 1:
  1328         _fail_nonlinear_revs(roots, roots.min(), b"root")
  1328         _fail_nonlinear_revs(roots, b"root")
  1329 
  1329 
  1330     fold = opts.get(b'fold')
  1330     fold = opts.get(b'fold')
  1331     if fold:
  1331     if fold:
  1332         if len(revs) == 1:
  1332         if len(revs) == 1:
  1333             # TODO: just switch to --no-fold instead?
  1333             # TODO: just switch to --no-fold instead?