]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Remove "arc merge" support for Mercurial
authorepriestley <git@epriestley.com>
Tue, 21 Feb 2012 17:27:52 +0000 (09:27 -0800)
committerepriestley <git@epriestley.com>
Tue, 21 Feb 2012 17:27:52 +0000 (09:27 -0800)
Summary:
Our one Mercurial client doesn't use it (T614) and I moved git off to "arc
land".

This workflow can never work properly for Mercurial without extensions anyway
since it doesn't have --no-ff.

Test Plan: Ran "arc merge" in SVN, git and Mercurial repositories.

Reviewers: btrahan, Makinde

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T614

Differential Revision: https://secure.phabricator.com/D1650

src/workflow/merge/ArcanistMergeWorkflow.php
src/workflow/merge/__init__.php

index 67ba55e6bc39df759ee08400fcf60baf6e8c949b..b572a54e0ed7fff3a3b2230e37a4c2cef353c24f 100644 (file)
  */
 
 /**
- * Merges a branch using "git merge" or "hg merge", using a template commit
- * message from Differential.
+ * Deprecated.
+ *
+ * TODO: Remove soon, once git users have had a chance to see the "use land
+ * instead" message.
  *
  * @group workflow
  */
@@ -26,50 +28,20 @@ final class ArcanistMergeWorkflow extends ArcanistBaseWorkflow {
 
   public function getCommandHelp() {
     return phutil_console_format(<<<EOTEXT
-      **merge** [__branch__] [--revision __revision_id__] [--show]
-          Supports: hg
-          Execute a "hg merge --rev <branch>" of a reviewed branch, but give the
-          merge commit a useful commit message with information from
-          Differential.
-
-          Tthis operates like "hg merge" (default) or "hg merge --rev <branch>"
-          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.
+      **merge**
+          Deprecated.
 
 EOTEXT
       );
   }
 
-  public function requiresWorkingCopy() {
-    return true;
-  }
-
-  public function requiresConduit() {
-    return true;
-  }
-
-  public function requiresAuthentication() {
-    return true;
-  }
-
   public function requiresRepositoryAPI() {
     return true;
   }
 
   public function getArguments() {
     return array(
-      'show' => array(
-        'help' =>
-          "Don't merge, just show the commit message."
-      ),
-      'revision' => array(
-        'param' => 'revision',
-        'help' =>
-          "Use the message for a specific revision. If 'arc' can't figure ".
-          "out which revision you want, you can tell it explicitly.",
-      ),
-      '*' => 'branch',
+      '*' => 'ignored',
     );
   }
 
@@ -82,86 +54,7 @@ EOTEXT
         "'arc land --keep-branch --hold --merge <feature_branch>' instead.");
     }
 
-    $this->writeStatusMessage(
-      phutil_console_format(
-        "**WARNING:** 'arc merge' is new and experimental.\n"));
-
-
-    if (!$repository_api->supportsLocalBranchMerge()) {
-      $name = $repository_api->getSourceControlSystemName();
-      throw new ArcanistUsageException(
-        "This source control system ('{$name}') does not support 'arc merge'.");
-    }
-
-    if ($repository_api->getUncommittedChanges()) {
-      throw new ArcanistUsageException(
-        "You have uncommitted changes in this working copy. Commit ".
-        "(or revert) them before proceeding.");
-    }
-
-    $branch = $this->getArgument('branch');
-    if (count($branch) > 1) {
-      throw new ArcanistUsageException("Specify only one branch to merge.");
-    } else {
-      $branch = head($branch);
-    }
-
-    $conduit = $this->getConduit();
-
-    $revisions = $conduit->callMethodSynchronous(
-      'differential.find',
-      array(
-        'guids' => array($this->getUserPHID()),
-        'query' => 'committable',
-      ));
-
-    // TODO: Make an effort to guess which revision the user means here. Branch
-    // name is a very strong heuristic but Conduit doesn't make it easy to get
-    // right now. We now also have "commits:local" after D857. Between these
-    // we should be able to get this right automatically in essentially every
-    // reasonable case.
-
-    try {
-      $revision = $this->chooseRevision(
-        $revisions,
-        $this->getArgument('revision'),
-        'Which revision do you want to merge?');
-      $revision_id = $revision->getID();
-    } catch (ArcanistChooseInvalidRevisionException $ex) {
-      throw new ArcanistUsageException(
-        "You can only merge Differential revisions which have been accepted.");
-    } catch (ArcanistChooseNoRevisionsException $ex) {
-      throw new ArcanistUsageException(
-        "You have no accepted Differential revisions.");
-    }
-
-    $message = $conduit->callMethodSynchronous(
-      'differential.getcommitmessage',
-      array(
-        'revision_id' => $revision_id,
-        'edit'        => false,
-      ));
-
-    if ($this->getArgument('show')) {
-      echo $message."\n";
-    } else {
-      $repository_api->performLocalBranchMerge($branch, $message);
-      echo "Merged '{$branch}'.\n";
-
-      $mark_workflow = $this->buildChildWorkflow(
-        'mark-committed',
-        array(
-          '--finalize',
-          $revision_id,
-        ));
-      $mark_workflow->run();
-    }
-
-    return 0;
-  }
-
-  protected function getSupportedRevisionControlSystems() {
-    return array('hg');
+    throw new ArcanistUsageException('arc merge is no longer supported.');
   }
 
 }
index 1f04a258f12b3eda1e6eebfcbb0704af9fe1e742..e28bc9097102402fcf4558507b55da34bb74a14a 100644 (file)
@@ -10,7 +10,6 @@ phutil_require_module('arcanist', 'exception/usage');
 phutil_require_module('arcanist', 'workflow/base');
 
 phutil_require_module('phutil', 'console');
-phutil_require_module('phutil', 'utils');
 
 
 phutil_require_source('ArcanistMergeWorkflow.php');