diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -450,7 +450,7 @@ except KeyError: pass - self._node = repo.unfiltered().changelog._partialmatch(changeid) + self._node = scmutil.resolvepartialhexnodeid(repo, changeid) if self._node is not None: self._rev = repo.changelog.rev(self._node) return diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -433,6 +433,15 @@ hexfunc = short return '%d:%s' % (rev, hexfunc(node)) +def resolvepartialhexnodeid(repo, prefix): + # Uses unfiltered repo because it's faster when then prefix is ambiguous/ + # This matches the "shortest" template function. + node = repo.unfiltered().changelog._partialmatch(prefix) + if node is None: + return + repo.changelog.rev(node) # make sure node isn't filtered + return node + def isrevsymbol(repo, symbol): try: revsymbol(repo, symbol)