Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 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 | a9e010cd66e1 |
children | 0806fa2a39d8 |
comparison
equal
deleted
inserted
replaced
29395:4c8026babe8c | 29396:d0ae5b8f80dc |
---|---|
939 if n and self.hasnode(n): | 939 if n and self.hasnode(n): |
940 return n | 940 return n |
941 return None | 941 return None |
942 except RevlogError: | 942 except RevlogError: |
943 # parsers.c radix tree lookup gave multiple matches | 943 # parsers.c radix tree lookup gave multiple matches |
944 # fast path: for unfiltered changelog, radix tree is accurate | |
945 if not getattr(self, 'filteredrevs', None): | |
946 raise LookupError(id, self.indexfile, | |
947 _('ambiguous identifier')) | |
944 # fall through to slow path that filters hidden revisions | 948 # fall through to slow path that filters hidden revisions |
945 pass | |
946 except (AttributeError, ValueError): | 949 except (AttributeError, ValueError): |
947 # we are pure python, or key was too short to search radix tree | 950 # we are pure python, or key was too short to search radix tree |
948 pass | 951 pass |
949 | 952 |
950 if id in self._pcache: | 953 if id in self._pcache: |