]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix hg arc land on hg-svn repos
authordurham <durham@fb.com>
Fri, 25 Jan 2013 19:52:14 +0000 (11:52 -0800)
committerdurham <durham@fb.com>
Fri, 25 Jan 2013 22:00:52 +0000 (14:00 -0800)
Summary:
arc land on a hg-svn repository would fail because arc land
uses 'hg push -r' to specify which revs to push which is not supported
by hg-svn. Now we just use 'hg push' which, when used against svn, only
pushes the current branch (which happens to be the branch we're trying to land).

We can't use standard 'hg push' for non-svn repos though because when used
against a vanilla hg repo 'hg push' pushes all branches.

Also remove --new-branch from 'hg push' because it's extremely
unlikely that a person wants to create a new branch on the server via
arc land.

Test Plan:
Ran arc land on a normal hg repo, verified it used 'hg push -r'.
Ran arc land on a hg-svn repo, verified it used 'hg push' and it pushed the
correct changes.

Reviewers: epriestley, sid0, dschleimer

Reviewed By: epriestley

CC: bos, aran, Korvin
Maniphest Tasks: T2403

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

src/workflow/ArcanistLandWorkflow.php

index c651376b6f98c9095b051e3e4b3a7eb93ceaa983..5e7919208f0c2dd9d5f145b454be00b4faea6ab9 100644 (file)
@@ -9,6 +9,7 @@ final class ArcanistLandWorkflow extends ArcanistBaseWorkflow {
   private $isGit;
   private $isGitSvn;
   private $isHg;
+  private $isHgSvn;
 
   private $oldBranch;
   private $branch;
@@ -185,6 +186,11 @@ EOTEXT
       $this->isGitSvn = (idx($repository, 'vcs') == 'svn');
     }
 
+    if ($this->isHg) {
+      list ($err) = $repository_api->execManualLocal('svn info');
+      $this->isHgSvn = !$err;
+    }
+
     $branch = $this->getArgument('branch');
     if (empty($branch)) {
       $branch = $this->getBranchOrBookmark();
@@ -732,9 +738,17 @@ EOTEXT
           $this->remote,
           $this->onto);
         $cmd = "git push";
+      } else if ($this->isHgSvn) {
+        // hg-svn doesn't support 'push -r', so we do a normal push
+        // which hg-svn modifies to only push the current branch and
+        // ancestors.
+        $err = $repository_api->execPassthru(
+          'push %s',
+          $this->remote);
+        $cmd = "hg push";
       } else if ($this->isHg) {
         $err = $repository_api->execPassthru(
-          'push --new-branch -r %s %s',
+          'push -r %s %s',
           $this->onto,
           $this->remote);
         $cmd = "hg push";