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
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;
"configuration.");
// NOTE: This should be safe because Mercurial doesn't support
// amend until 2.2.
- return '.^';
+ return $this->getCanonicalRevisionName('.^');
}
break;
case 'bookmark':
$this->setBaseCommitExplanation(
"you specified '{$rule}' in your {$source} 'base' ".
"configuration.");
- return '.^';
+ return $this->getCanonicalRevisionName('.^');
}
break;
default: