]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Use .^ instead of HEAD^ for mercurial
authorJamie Wong <jamie.lf.wong@gmail.com>
Fri, 8 Jun 2012 20:57:50 +0000 (16:57 -0400)
committerJamie Wong <jamie.lf.wong@gmail.com>
Mon, 11 Jun 2012 14:00:02 +0000 (10:00 -0400)
Summary:
##arc amend## in a mercurial repo was failing with this message

    Usage Exception: Commit 'HEAD^' is not a valid Mercurial commit identifier.

mercurial's .^ is about the same thing as git's HEAD^

Test Plan:
##arc amend## in a mercurial repo with ##"immutable_history" : "false"## in the
##.arcconfig##.

Reviewers: epriestley

Reviewed By: epriestley

CC: vrana, aran, Korvin
Differential Revision: https://secure.phabricator.com/D2690

src/workflow/ArcanistAmendWorkflow.php

index d4eb397275d64135f02ba8548f9f6cb10c92184a..6fa3938f2b8f14e9cf7aeb7ccfffaaa130e9ec8e 100644 (file)
@@ -102,7 +102,11 @@ EOTEXT
       $revision_id = $this->normalizeRevisionID($this->getArgument('revision'));
     }
 
-    $repository_api->setRelativeCommit('HEAD^');
+    if ($repository_api instanceof ArcanistGitAPI) {
+      $repository_api->setRelativeCommit('HEAD^');
+    } else if ($repository_api instanceof ArcanistMercurialAPI) {
+      $repository_api->setRelativeCommit('.^');
+    }
 
     $in_working_copy = $repository_api->loadWorkingCopyDifferentialRevisions(
       $this->getConduit(),