From 76a2976fd9a4acff125385457dae3f6ad844db85 Mon Sep 17 00:00:00 2001 From: Christopher Speck Date: Wed, 21 Jul 2021 16:50:35 -0400 Subject: [PATCH] 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 --- src/land/engine/ArcanistMercurialLandEngine.php | 16 ++++++++++++---- src/repository/api/ArcanistMercurialAPI.php | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/land/engine/ArcanistMercurialLandEngine.php b/src/land/engine/ArcanistMercurialLandEngine.php index 32d1fa46..6a78c149 100644 --- a/src/land/engine/ArcanistMercurialLandEngine.php +++ b/src/land/engine/ArcanistMercurialLandEngine.php @@ -834,14 +834,19 @@ final class ArcanistMercurialLandEngine $argv[] = '--keep'; $argv[] = '--collapse'; - $future = $api->execFutureLocal('rebase %Ls', $argv); + $future = $api->execFutureLocalWithExtension( + 'rebase', + 'rebase %Ls', + $argv); $future->write($commit_message); $future->resolvex(); } catch (CommandException $ex) { // Aborting the rebase should restore the same state prior to running the // rebase command. - $api->execManualLocal('rebase --abort'); + $api->execManualLocalWithExtension( + 'rebase', + 'rebase --abort'); throw $ex; } @@ -1064,14 +1069,17 @@ final class ArcanistMercurialLandEngine // be deleted, we can skip this rebase? try { - $api->execxLocal( + $api->execxLocalWithExtension( + 'rebase', 'rebase --source %s --dest %s --keep --keepbranches', $child_hash, $new_commit); } catch (CommandException $ex) { // Aborting the rebase should restore the same state prior to running // the rebase command. - $api->execManualLocal('rebase --abort'); + $api->execManualLocalWithExtension( + 'rebase', + 'rebase --abort'); throw $ex; } } diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php index 9eecf0e2..55ef9ef5 100644 --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -1149,6 +1149,20 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { $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) { if (array_key_exists($feature, $this->featureResults)) { return $this->featureResults[$feature];