mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 18:22:41 +01:00
Restore order of operations after D4056
Summary: See discussion in D4056. In `findRevision()` we call `loadWorkingCopyDifferentialRevisions()`. However, this method depends upon the state of the working copy, because the end of the commit range it examines is HEAD. Prior to D4056 we checked out the target branch before calling `findRevision()`; after D4056 we call it earlier. This isn't problematic in the `arc land` case, but in the `arc land <branch>` case it means we may fail to identify a revision, or identify the wrong revision, because HEAD isn't where we expect it to be. Instead, unconditionally check out the target branch before finding the revision. See <http://dl.dropbox.com/u/116385/Slingshot/Pictures/Screen%20Shot%202012-12-03%20at%203.43.45%20PM.png> for a transcript of the issue. Test Plan: Reproduced issue as per link above. Ran `arc land --keep-branch --hold somebranch` successfully after this patch. Reviewers: DurhamGoode, zeeg Reviewed By: DurhamGoode CC: aran Differential Revision: https://secure.phabricator.com/D4072
This commit is contained in:
parent
e8eacb6ae3
commit
886c1721dd
1 changed files with 23 additions and 23 deletions
|
@ -117,9 +117,11 @@ EOTEXT
|
||||||
public function run() {
|
public function run() {
|
||||||
$this->readArguments();
|
$this->readArguments();
|
||||||
$this->validate();
|
$this->validate();
|
||||||
$this->findRevision();
|
|
||||||
$this->pullFromRemote();
|
$this->pullFromRemote();
|
||||||
|
|
||||||
|
$this->checkoutBranch();
|
||||||
|
$this->findRevision();
|
||||||
|
|
||||||
if ($this->useSquash) {
|
if ($this->useSquash) {
|
||||||
$this->rebase();
|
$this->rebase();
|
||||||
$this->squash();
|
$this->squash();
|
||||||
|
@ -221,6 +223,17 @@ EOTEXT
|
||||||
$this->requireCleanWorkingCopy();
|
$this->requireCleanWorkingCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function checkoutBranch() {
|
||||||
|
$repository_api = $this->getRepositoryAPI();
|
||||||
|
$repository_api->execxLocal(
|
||||||
|
'checkout %s',
|
||||||
|
$this->branch);
|
||||||
|
|
||||||
|
echo phutil_console_format(
|
||||||
|
"Switched to branch **%s**. Identifying and merging...\n",
|
||||||
|
$this->branch);
|
||||||
|
}
|
||||||
|
|
||||||
private function findRevision() {
|
private function findRevision() {
|
||||||
$repository_api = $this->getRepositoryAPI();
|
$repository_api = $this->getRepositoryAPI();
|
||||||
|
|
||||||
|
@ -313,15 +326,7 @@ EOTEXT
|
||||||
|
|
||||||
private function rebase() {
|
private function rebase() {
|
||||||
$repository_api = $this->getRepositoryAPI();
|
$repository_api = $this->getRepositoryAPI();
|
||||||
$repository_api->execxLocal(
|
|
||||||
'checkout %s',
|
|
||||||
$this->branch);
|
|
||||||
|
|
||||||
echo phutil_console_format(
|
|
||||||
"Switched to branch **%s**. Identifying and merging...\n",
|
|
||||||
$this->branch);
|
|
||||||
|
|
||||||
if ($this->useSquash) {
|
|
||||||
chdir($repository_api->getPath());
|
chdir($repository_api->getPath());
|
||||||
$err = phutil_passthru('git rebase %s', $this->onto);
|
$err = phutil_passthru('git rebase %s', $this->onto);
|
||||||
|
|
||||||
|
@ -333,11 +338,6 @@ EOTEXT
|
||||||
"--continue' to continue forward. After resolving the rebase, ".
|
"--continue' to continue forward. After resolving the rebase, ".
|
||||||
"run 'arc land' again.");
|
"run 'arc land' again.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we've rebased, the merge-base of origin/master and HEAD may
|
|
||||||
// be different. Reparse the relative commit.
|
|
||||||
$repository_api->parseRelativeLocalCommit(array($this->ontoRemoteBranch));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function squash() {
|
private function squash() {
|
||||||
|
|
Loading…
Reference in a new issue