diff --git a/src/workflow/ArcanistLandWorkflow.php b/src/workflow/ArcanistLandWorkflow.php --- a/src/workflow/ArcanistLandWorkflow.php +++ b/src/workflow/ArcanistLandWorkflow.php @@ -701,19 +701,21 @@ // Collapse just the landing branch onto master. // Leave its children on the original branch. - $err = $repository_api->execPassthru( - 'rebase --collapse --keep --logfile %s -r %s -d %s', - $this->messageFile, - $branch_range, - $this->onto); + if ($branch_root !== $branch_rev_id) { + $err = $repository_api->execPassthru( + 'rebase --collapse --keep --logfile %s -r %s -d %s', + $this->messageFile, + $branch_range, + $this->onto); - if ($err) { - $repository_api->execManualLocal( - 'rebase --abort'); - $this->restoreBranch(); - throw new ArcanistUsageException( - "Squashing the commits under {$this->branch} failed. ". - "Manually squash your commits and run 'arc land' again."); + if ($err) { + $repository_api->execManualLocal( + 'rebase --abort'); + $this->restoreBranch(); + throw new ArcanistUsageException( + "Squashing the commits under {$this->branch} failed. ". + "Manually squash your commits and run 'arc land' again."); + } } if ($repository_api->isBookmark($this->branch)) { @@ -734,7 +736,7 @@ // check if the branch had children list($output) = $repository_api->execxLocal( "log -r %s --template %s", - hgsprintf("children(%s)", $this->branch), + hgsprintf("children(%s) - children(%s)", $this->branch, $this->onto), '{node}\n'); $child_branch_roots = phutil_split_lines($output, false); @@ -985,9 +987,11 @@ $this->branch, $common_ancestor)); - $repository_api->execxLocal( - '--config extensions.mq= strip -r %s', - $branch_root); + if ($branch_root !== '') { + $repository_api->execxLocal( + '--config extensions.mq= strip -r %s', + $branch_root); + } if ($repository_api->isBookmark($this->branch)) { $repository_api->execxLocal(