]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Allow running `arc land` after `git svn rebase`
authorvrana <jakubv@fb.com>
Mon, 28 Jan 2013 23:54:37 +0000 (15:54 -0800)
committervrana <jakubv@fb.com>
Tue, 29 Jan 2013 01:47:17 +0000 (17:47 -0800)
Summary: `git pull` may fail in git-svn after rebasing (which is a side effect of dcommit).

Test Plan:
  $ git svn rebase
  $ git log trunk..master
  $ git pull --ff-only; echo $?

Reviewers: epriestley

Reviewed By: epriestley

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

src/workflow/ArcanistLandWorkflow.php

index da5d1bb71b8afe76923cc438b548d4b430f49481..772233a4aaf56f17cccd96a913116c6db1a3e147 100644 (file)
@@ -384,17 +384,23 @@ EOTEXT
 
     $local_ahead_of_remote = false;
     if ($this->isGit) {
-      $repository_api->execxLocal('pull --ff-only');
-
-      if (!$this->isGitSvn) {
+      try {
+        $repository_api->execxLocal('pull --ff-only');
+      } catch (CommandException $ex) {
+        if (!$this->isGitSvn) {
+          throw $ex;
+        }
         list($out) = $repository_api->execxLocal(
           'log %s..%s',
           $this->ontoRemoteBranch,
           $this->onto);
         if (strlen(trim($out))) {
           $local_ahead_of_remote = true;
+        } else {
+          $repository_api->execxLocal('svn rebase');
         }
       }
+
     } else if ($this->isHg) {
       // execManual instead of execx because outgoing returns
       // code 1 when there is nothing outgoing