1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 08:12:40 +01:00

Update other usages of "hg rebase" to use the new extension-enabling function

Summary:
Refs T13659, D21697.

I suppose I missed these cases.

Test Plan:
- I ran `arc land --test` and verified the rebase used by `ArcanistMercurialLandEngine` was run with the flag to enable the extension.
```
$ hg --encoding utf-8 --config 'extensions.rebase=' rebase --dest 2fd68f4c48aaab9f6d5613b90e60b8219a9af0ae --rev 6132da63090c2c8a8d479aaae7b20497dda3e8fd..6132da63090c2c8a8d479aaae7b20497dda3e8fd --logfile - --keep --collapse
```

- I modified the merging to throw an exception before writing to the future's stdin and verified that after `arc` completed there was no rebase active.

- I set up 3 dependent diffs and landed the middle revision and verified the first and second revisions landed but not the tip revision and there were no errors and the resulting working directory was correct.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T13659

Differential Revision: https://secure.phabricator.com/D21706
This commit is contained in:
Christopher Speck 2021-07-21 16:50:35 -04:00
parent ec68005d75
commit 76a2976fd9
2 changed files with 26 additions and 4 deletions

View file

@ -834,14 +834,19 @@ final class ArcanistMercurialLandEngine
$argv[] = '--keep'; $argv[] = '--keep';
$argv[] = '--collapse'; $argv[] = '--collapse';
$future = $api->execFutureLocal('rebase %Ls', $argv); $future = $api->execFutureLocalWithExtension(
'rebase',
'rebase %Ls',
$argv);
$future->write($commit_message); $future->write($commit_message);
$future->resolvex(); $future->resolvex();
} catch (CommandException $ex) { } catch (CommandException $ex) {
// Aborting the rebase should restore the same state prior to running the // Aborting the rebase should restore the same state prior to running the
// rebase command. // rebase command.
$api->execManualLocal('rebase --abort'); $api->execManualLocalWithExtension(
'rebase',
'rebase --abort');
throw $ex; throw $ex;
} }
@ -1064,14 +1069,17 @@ final class ArcanistMercurialLandEngine
// be deleted, we can skip this rebase? // be deleted, we can skip this rebase?
try { try {
$api->execxLocal( $api->execxLocalWithExtension(
'rebase',
'rebase --source %s --dest %s --keep --keepbranches', 'rebase --source %s --dest %s --keep --keepbranches',
$child_hash, $child_hash,
$new_commit); $new_commit);
} catch (CommandException $ex) { } catch (CommandException $ex) {
// Aborting the rebase should restore the same state prior to running // Aborting the rebase should restore the same state prior to running
// the rebase command. // the rebase command.
$api->execManualLocal('rebase --abort'); $api->execManualLocalWithExtension(
'rebase',
'rebase --abort');
throw $ex; throw $ex;
} }
} }

View file

@ -1149,6 +1149,20 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
$extended_args); $extended_args);
} }
public function execManualLocalWithExtension(
$extension,
$pattern /* , ... */) {
$args = func_get_args();
$extended_args = call_user_func_array(
array($this, 'buildMercurialExtensionCommand'),
$args);
return call_user_func_array(
array($this, 'execManualLocal'),
$extended_args);
}
private function executeMercurialFeatureTest($feature, $resolve) { private function executeMercurialFeatureTest($feature, $resolve) {
if (array_key_exists($feature, $this->featureResults)) { if (array_key_exists($feature, $this->featureResults)) {
return $this->featureResults[$feature]; return $this->featureResults[$feature];