1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-24 15:52:40 +01:00

Correct some minor "arc land" workflow issues in Mercurial

Summary: Ref T9948. Ref T13546. Clean up some minor behaviors to allow "arc land" to function in the simplest cases again. Also, do a capability test for "prune" rather than just falling back.

Test Plan: Ran "arc land <mark>" in Mercurial, got changes pushed.

Maniphest Tasks: T13546, T9948

Differential Revision: https://secure.phabricator.com/D21350
This commit is contained in:
epriestley 2020-06-10 15:51:30 -07:00
parent 86951ad067
commit 50c534b591
2 changed files with 12 additions and 13 deletions

View file

@ -288,7 +288,7 @@ final class ArcanistMercurialLandEngine
$onto_markers[] = $new_bookmark; $onto_markers[] = $new_bookmark;
$new_markers[] = $new_bookmark; $new_markers[] = $new_bookmark;
} else { } else {
$onto_markers[] = $marker; $onto_markers[] = head($matches);
} }
} }
@ -553,9 +553,6 @@ final class ArcanistMercurialLandEngine
pht('Merge target is ambiguous.')); pht('Merge target is ambiguous.'));
} }
$is_bookmark = false;
$is_branch = false;
if ($bookmarks) { if ($bookmarks) {
if (count($bookmarks) > 1) { if (count($bookmarks) > 1) {
throw new Exception( throw new Exception(
@ -592,7 +589,7 @@ final class ArcanistMercurialLandEngine
$target_marker = $branch; $target_marker = $branch;
} }
if ($is_branch) { if ($target_marker->isBranch()) {
$err = $this->newPassthru( $err = $this->newPassthru(
'pull --branch %s -- %s', 'pull --branch %s -- %s',
$target->getRef(), $target->getRef(),
@ -728,7 +725,7 @@ final class ArcanistMercurialLandEngine
$branch_marker = $this->ontoBranchMarker; $branch_marker = $this->ontoBranchMarker;
if ($branch_marker) { if ($branch_marker) {
$api->execxLocal('branch -- %s', $branch_marker); $api->execxLocal('branch -- %s', $branch_marker->getName());
} }
try { try {
@ -892,7 +889,7 @@ final class ArcanistMercurialLandEngine
return; return;
} }
$strip = array(); $revs = array();
// We've rebased all descendants already, so we can safely delete all // We've rebased all descendants already, so we can safely delete all
// of these commits. // of these commits.
@ -904,10 +901,10 @@ final class ArcanistMercurialLandEngine
$min_commit = head($commits)->getHash(); $min_commit = head($commits)->getHash();
$max_commit = last($commits)->getHash(); $max_commit = last($commits)->getHash();
$strip[] = hgsprintf('%s::%s', $min_commit, $max_commit); $revs[] = hgsprintf('%s::%s', $min_commit, $max_commit);
} }
$rev_set = '('.implode(') or (', $strip).')'; $rev_set = '('.implode(') or (', $revs).')';
// See PHI45. If we have "hg evolve", get rid of old commits using // See PHI45. If we have "hg evolve", get rid of old commits using
// "hg prune" instead of "hg strip". // "hg prune" instead of "hg strip".
@ -916,11 +913,11 @@ final class ArcanistMercurialLandEngine
// removes the obsolescence marker and revives the predecessor. This is // removes the obsolescence marker and revives the predecessor. This is
// not desirable: we want to destroy all predecessors of these commits. // not desirable: we want to destroy all predecessors of these commits.
try { if ($api->getMercurialFeature('evolve')) {
$api->execxLocal( $api->execxLocal(
'--config extensions.evolve= prune --rev %s', 'prune --rev %s',
$rev_set); $rev_set);
} catch (CommandException $ex) { } else {
$api->execxLocal( $api->execxLocal(
'--config extensions.strip= strip --rev %s', '--config extensions.strip= strip --rev %s',
$rev_set); $rev_set);

View file

@ -980,7 +980,9 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
switch ($feature) { switch ($feature) {
case 'shelve': case 'shelve':
return $this->execFutureLocal( return $this->execFutureLocal(
'--config extensions.shelve= shelve --help'); '--config extensions.shelve= shelve --help --');
case 'evolve':
return $this->execFutureLocal('prune --help --');
default: default:
throw new Exception( throw new Exception(
pht( pht(