mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 08:52:39 +01:00
Fix "arc:this" and "arc:amended" base rules after D4838
Summary: After D4383, we escape the base commit when constructing a command like this: hg log --rev (base::. - base) However, if the base commit is a revset like ".^", we now escape it and Mercurial looks for a commit named ".^" (a valid mercurial branch name) instead. Fix this by returning nodes for these rules instead of revsets. The "arc:this" rule is automatically used in some operations, like "arc amend", so users can hit this during normal workflows, not just with weird `--base` rules. Test Plan: Ran "arc amend" in a Mercurial repository, didn't fatal out. Reviewers: DurhamGoode, sid0 Reviewed By: DurhamGoode CC: tido, aran Differential Revision: https://secure.phabricator.com/D4949
This commit is contained in:
parent
7803b7da27
commit
39704f1e49
1 changed files with 7 additions and 2 deletions
|
@ -672,6 +672,11 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
public function resolveBaseCommitRule($rule, $source) {
|
||||
list($type, $name) = explode(':', $rule, 2);
|
||||
|
||||
// NOTE: This function MUST return node hashes or symbolic commits (like
|
||||
// branch names or the word "tip"), not revsets. This includes ".^" and
|
||||
// similar, which a revset, not a symbolic commit identifier. If you return
|
||||
// a revset it will be escaped later and looked up literally.
|
||||
|
||||
switch ($type) {
|
||||
case 'hg':
|
||||
$matches = null;
|
||||
|
@ -728,7 +733,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
"configuration.");
|
||||
// NOTE: This should be safe because Mercurial doesn't support
|
||||
// amend until 2.2.
|
||||
return '.^';
|
||||
return $this->getCanonicalRevisionName('.^');
|
||||
}
|
||||
break;
|
||||
case 'bookmark':
|
||||
|
@ -754,7 +759,7 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
$this->setBaseCommitExplanation(
|
||||
"you specified '{$rule}' in your {$source} 'base' ".
|
||||
"configuration.");
|
||||
return '.^';
|
||||
return $this->getCanonicalRevisionName('.^');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue