1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-30 02:32:41 +01:00

Allow hg arc land when no rebase is necessary

Summary:
Previously, trying to arc land in a mercurial repo would
fail if the local branch was already at the tip of the onto branch
(since hg rebase exited with code 1).  This change makes it check
if a rebase is needed before executing the rebase.

Test Plan:
hg init foo
cd foo
hg bookmark master
touch a && hg add a && hg commit -ma
// setup your .arcconfig
cd ..
hg clone foo foo2
cd foo2
hg bookmark mybook
touch b && hg add b && hg commit -mb
arc land --onto master --revision <your rev number>

Arc land should succeed.  I also tried landing when a rebase was
necessary and it still worked.

Reviewers: epriestley, dschleimer, bos

Reviewed By: epriestley

CC: sid0, aran, Korvin

Differential Revision: https://secure.phabricator.com/D4588
This commit is contained in:
durham 2013-01-22 14:29:00 -08:00
parent 98fec27752
commit 880964af83

View file

@ -470,6 +470,14 @@ EOTEXT
} }
} }
} else if ($this->isHg) { } else if ($this->isHg) {
$onto_tip = $repository_api->getCanonicalRevisionName($this->onto);
$common_ancestor = $repository_api->getCanonicalRevisionName(
sprintf("ancestor('%s','%s')",
$this->onto,
$this->branch));
// Only rebase if the local branch is not at the tip of the onto branch.
if ($onto_tip != $common_ancestor) {
// keep branch here so later we can decide whether to remove it // keep branch here so later we can decide whether to remove it
$err = $repository_api->execPassthru( $err = $repository_api->execPassthru(
'rebase -d %s --keepbranches', 'rebase -d %s --keepbranches',
@ -483,6 +491,7 @@ EOTEXT
"run 'arc land' again."); "run 'arc land' again.");
} }
} }
}
$repository_api->reloadWorkingCopy(); $repository_api->reloadWorkingCopy();
} }