1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-10 00:42: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;
$new_markers[] = $new_bookmark;
} else {
$onto_markers[] = $marker;
$onto_markers[] = head($matches);
}
}
@ -553,9 +553,6 @@ final class ArcanistMercurialLandEngine
pht('Merge target is ambiguous.'));
}
$is_bookmark = false;
$is_branch = false;
if ($bookmarks) {
if (count($bookmarks) > 1) {
throw new Exception(
@ -592,7 +589,7 @@ final class ArcanistMercurialLandEngine
$target_marker = $branch;
}
if ($is_branch) {
if ($target_marker->isBranch()) {
$err = $this->newPassthru(
'pull --branch %s -- %s',
$target->getRef(),
@ -728,7 +725,7 @@ final class ArcanistMercurialLandEngine
$branch_marker = $this->ontoBranchMarker;
if ($branch_marker) {
$api->execxLocal('branch -- %s', $branch_marker);
$api->execxLocal('branch -- %s', $branch_marker->getName());
}
try {
@ -892,7 +889,7 @@ final class ArcanistMercurialLandEngine
return;
}
$strip = array();
$revs = array();
// We've rebased all descendants already, so we can safely delete all
// of these commits.
@ -904,10 +901,10 @@ final class ArcanistMercurialLandEngine
$min_commit = head($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
// "hg prune" instead of "hg strip".
@ -916,11 +913,11 @@ final class ArcanistMercurialLandEngine
// removes the obsolescence marker and revives the predecessor. This is
// not desirable: we want to destroy all predecessors of these commits.
try {
if ($api->getMercurialFeature('evolve')) {
$api->execxLocal(
'--config extensions.evolve= prune --rev %s',
'prune --rev %s',
$rev_set);
} catch (CommandException $ex) {
} else {
$api->execxLocal(
'--config extensions.strip= strip --rev %s',
$rev_set);

View file

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