From: epriestley Date: Mon, 20 Feb 2012 20:51:14 +0000 (-0800) Subject: Replace "arc merge" with "arc land --merge" for git X-Git-Tag: conduit-4~146 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=085963501b451c6ab82f61615337dbcd4eb712c3;p=arcanist.git Replace "arc merge" with "arc land --merge" for git Summary: I think "arc land" is better than "arc merge" in every case? Make "arc merge" hg-only (possibly nuke it later, see T614) and point users at "arc land". Add an explicit "--merge" flag to force --no-ff behavior in mutable reposiories. Test Plan: Ran "arc land --hold --merge " on this branch, got a clean merge. Reviewers: fratrik, btrahan Reviewed By: btrahan CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1647 --- diff --git a/src/workflow/land/ArcanistLandWorkflow.php b/src/workflow/land/ArcanistLandWorkflow.php index 76f10da6..4dbfabb7 100644 --- a/src/workflow/land/ArcanistLandWorkflow.php +++ b/src/workflow/land/ArcanistLandWorkflow.php @@ -25,7 +25,7 @@ final class ArcanistLandWorkflow extends ArcanistBaseWorkflow { public function getCommandHelp() { return phutil_console_format(<< 'origin', 'help' => "Push to a remote other than 'origin' (default).", ), + 'merge' => array( + 'help' => 'Perform a --no-ff merge, not a --squash merge. If the '. + 'project is marked as having an immutable history, this is '. + 'the default behavior.', + ), '*' => 'branch', ); } @@ -90,7 +96,8 @@ EOTEXT $remote = $this->getArgument('remote', 'origin'); $onto = $this->getArgument('onto', 'master'); - $is_immutable = $this->isHistoryImmutable(); + $is_immutable = $this->isHistoryImmutable() || + $this->getArgument('merge'); $repository_api = $this->getRepositoryAPI(); if (!($repository_api instanceof ArcanistGitAPI)) { @@ -192,7 +199,7 @@ EOTEXT if ($revision['status'] != ArcanistDifferentialRevisionStatus::ACCEPTED) { $ok = phutil_console_confirm( - "Revision 'D{$id}: {$rev_title}' has not been accepted. Continue ". + "Revision 'D{$rev_id}: {$rev_title}' has not been accepted. Continue ". "anyway?"); if (!$ok) { throw new ArcanistUserAbortException(); @@ -224,7 +231,7 @@ EOTEXT throw new ArcanistUsageException( "'git merge' failed. Your working copy has been left in a partially ". "merged state. You can: abort with 'git merge --abort'; or follow ". - "the instructions to complete the merge, and then push."); + "the instructions to complete the merge."); } } else { // In mutable histories, do a --squash merge. diff --git a/src/workflow/merge/ArcanistMergeWorkflow.php b/src/workflow/merge/ArcanistMergeWorkflow.php index 0271c127..67ba55e6 100644 --- a/src/workflow/merge/ArcanistMergeWorkflow.php +++ b/src/workflow/merge/ArcanistMergeWorkflow.php @@ -27,19 +27,15 @@ final class ArcanistMergeWorkflow extends ArcanistBaseWorkflow { public function getCommandHelp() { return phutil_console_format(<<" or "hg merge --rev " of a - reviewed branch, but give the merge commit a useful commit message - with information from Differential. + Supports: hg + Execute a "hg merge --rev " of a reviewed branch, but give the + merge commit a useful commit message with information from + Differential. - In Git, this operates like "git merge " and should be executed - from the branch you want to merge __into__, just like "git merge". - Branch is required. - - In Mercurial, this operates like "hg merge" (default) or - "hg merge --rev " and should be executed from the branch you - want to merge __from__, just like "hg merge". It will also effect an - "hg commit" with a rich commit message. + Tthis operates like "hg merge" (default) or "hg merge --rev " + and should be executed from the branch you want to merge __from__, + just like "hg merge". It will also effect an "hg commit" with a rich + commit message if possible. EOTEXT ); @@ -78,11 +74,19 @@ EOTEXT } public function run() { + $repository_api = $this->getRepositoryAPI(); + + if ($repository_api instanceof ArcanistGitAPI) { + throw new ArcanistUsageException( + "'arc merge' no longer supports git. Use ". + "'arc land --keep-branch --hold --merge ' instead."); + } + $this->writeStatusMessage( phutil_console_format( "**WARNING:** 'arc merge' is new and experimental.\n")); - $repository_api = $this->getRepositoryAPI(); + if (!$repository_api->supportsLocalBranchMerge()) { $name = $repository_api->getSourceControlSystemName(); throw new ArcanistUsageException( @@ -157,7 +161,7 @@ EOTEXT } protected function getSupportedRevisionControlSystems() { - return array('git', 'hg'); + return array('hg'); } }