Mercurial > hg-stable
changeset 29396:d0ae5b8f80dc
revlog: add a fast path for "ambiguous identifier"
Before fd1bb7c, if the C index.partialmatch raises RevlogError, the Python
code raises "ambiguous identifier" error immediately, which is efficient.
fd1bb7c took hidden revisions into consideration and forced the slow path
enumerating the changelog to double-check hidden revisions. But it's not
necessary if we know the revlog has no hidden revisions.
This patch adds back the fast path for unfiltered revlogs.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 22 Jun 2016 21:30:49 +0100 |
parents | 4c8026babe8c |
children | 844f72885fb9 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Thu Jun 23 20:45:37 2016 -0400 +++ b/mercurial/revlog.py Wed Jun 22 21:30:49 2016 +0100 @@ -941,8 +941,11 @@ return None except RevlogError: # parsers.c radix tree lookup gave multiple matches + # fast path: for unfiltered changelog, radix tree is accurate + if not getattr(self, 'filteredrevs', None): + raise LookupError(id, self.indexfile, + _('ambiguous identifier')) # fall through to slow path that filters hidden revisions - pass except (AttributeError, ValueError): # we are pure python, or key was too short to search radix tree pass