From 0586b12d2f06cb59bd55c64f8a0931f86375b14a Mon Sep 17 00:00:00 2001 From: vrana Date: Mon, 28 Jan 2013 15:54:37 -0800 Subject: [PATCH] Allow running `arc land` after `git svn rebase` 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/workflow/ArcanistLandWorkflow.php b/src/workflow/ArcanistLandWorkflow.php index da5d1bb7..772233a4 100644 --- a/src/workflow/ArcanistLandWorkflow.php +++ b/src/workflow/ArcanistLandWorkflow.php @@ -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