mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 18:22: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:
parent
98fec27752
commit
880964af83
1 changed files with 20 additions and 11 deletions
|
@ -470,17 +470,26 @@ EOTEXT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($this->isHg) {
|
} else if ($this->isHg) {
|
||||||
// keep branch here so later we can decide whether to remove it
|
$onto_tip = $repository_api->getCanonicalRevisionName($this->onto);
|
||||||
$err = $repository_api->execPassthru(
|
$common_ancestor = $repository_api->getCanonicalRevisionName(
|
||||||
'rebase -d %s --keepbranches',
|
sprintf("ancestor('%s','%s')",
|
||||||
$this->onto);
|
$this->onto,
|
||||||
if ($err) {
|
$this->branch));
|
||||||
throw new ArcanistUsageException(
|
|
||||||
"'hg rebase {$this->onto}' failed. ".
|
// Only rebase if the local branch is not at the tip of the onto branch.
|
||||||
"You can abort with 'hg rebase --abort', ".
|
if ($onto_tip != $common_ancestor) {
|
||||||
"or resolve conflicts and use 'hg rebase ".
|
// keep branch here so later we can decide whether to remove it
|
||||||
"--continue' to continue forward. After resolving the rebase, ".
|
$err = $repository_api->execPassthru(
|
||||||
"run 'arc land' again.");
|
'rebase -d %s --keepbranches',
|
||||||
|
$this->onto);
|
||||||
|
if ($err) {
|
||||||
|
throw new ArcanistUsageException(
|
||||||
|
"'hg rebase {$this->onto}' failed. ".
|
||||||
|
"You can abort with 'hg rebase --abort', ".
|
||||||
|
"or resolve conflicts and use 'hg rebase ".
|
||||||
|
"--continue' to continue forward. After resolving the rebase, ".
|
||||||
|
"run 'arc land' again.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue