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.
--- 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