From c8efb4181129ac985db58e7505c2495cd4776bd2 Mon Sep 17 00:00:00 2001 From: durham Date: Fri, 25 Jan 2013 11:52:14 -0800 Subject: [PATCH] Fix hg arc land on hg-svn repos 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 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/workflow/ArcanistLandWorkflow.php b/src/workflow/ArcanistLandWorkflow.php index c651376b..5e791920 100644 --- a/src/workflow/ArcanistLandWorkflow.php +++ b/src/workflow/ArcanistLandWorkflow.php @@ -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";