Show More
@@ -58,6 +58,9 b' class LookupError(RevlogError, KeyError)' | |||||
58 | def __str__(self): |
|
58 | def __str__(self): | |
59 | return RevlogError.__str__(self) |
|
59 | return RevlogError.__str__(self) | |
60 |
|
60 | |||
|
61 | class AmbiguousPrefixLookupError(LookupError): | |||
|
62 | pass | |||
|
63 | ||||
61 | class FilteredLookupError(LookupError): |
|
64 | class FilteredLookupError(LookupError): | |
62 | pass |
|
65 | pass | |
63 |
|
66 |
@@ -860,7 +860,8 b' class localrepository(object):' | |||||
860 | def __contains__(self, changeid): |
|
860 | def __contains__(self, changeid): | |
861 | """True if the given changeid exists |
|
861 | """True if the given changeid exists | |
862 |
|
862 | |||
863 |
error.LookupError is raised if an ambiguous node |
|
863 | error.AmbiguousPrefixLookupError is raised if an ambiguous node | |
|
864 | specified. | |||
864 | """ |
|
865 | """ | |
865 | try: |
|
866 | try: | |
866 | self[changeid] |
|
867 | self[changeid] |
@@ -91,6 +91,7 b' REVIDX_RAWTEXT_CHANGING_FLAGS = REVIDX_I' | |||||
91 |
|
91 | |||
92 | RevlogError = error.RevlogError |
|
92 | RevlogError = error.RevlogError | |
93 | LookupError = error.LookupError |
|
93 | LookupError = error.LookupError | |
|
94 | AmbiguousPrefixLookupError = error.AmbiguousPrefixLookupError | |||
94 | CensoredNodeError = error.CensoredNodeError |
|
95 | CensoredNodeError = error.CensoredNodeError | |
95 | ProgrammingError = error.ProgrammingError |
|
96 | ProgrammingError = error.ProgrammingError | |
96 |
|
97 | |||
@@ -1788,8 +1789,8 b' class revlog(object):' | |||||
1788 | # parsers.c radix tree lookup gave multiple matches |
|
1789 | # parsers.c radix tree lookup gave multiple matches | |
1789 | # fast path: for unfiltered changelog, radix tree is accurate |
|
1790 | # fast path: for unfiltered changelog, radix tree is accurate | |
1790 | if not getattr(self, 'filteredrevs', None): |
|
1791 | if not getattr(self, 'filteredrevs', None): | |
1791 | raise LookupError(id, self.indexfile, |
|
1792 | raise AmbiguousPrefixLookupError(id, self.indexfile, | |
1792 | _('ambiguous identifier')) |
|
1793 | _('ambiguous identifier')) | |
1793 | # fall through to slow path that filters hidden revisions |
|
1794 | # fall through to slow path that filters hidden revisions | |
1794 | except (AttributeError, ValueError): |
|
1795 | except (AttributeError, ValueError): | |
1795 | # we are pure python, or key was too short to search radix tree |
|
1796 | # we are pure python, or key was too short to search radix tree | |
@@ -1810,8 +1811,8 b' class revlog(object):' | |||||
1810 | if len(nl) == 1 and not maybewdir: |
|
1811 | if len(nl) == 1 and not maybewdir: | |
1811 | self._pcache[id] = nl[0] |
|
1812 | self._pcache[id] = nl[0] | |
1812 | return nl[0] |
|
1813 | return nl[0] | |
1813 | raise LookupError(id, self.indexfile, |
|
1814 | raise AmbiguousPrefixLookupError(id, self.indexfile, | |
1814 | _('ambiguous identifier')) |
|
1815 | _('ambiguous identifier')) | |
1815 | if maybewdir: |
|
1816 | if maybewdir: | |
1816 | raise error.WdirUnsupported |
|
1817 | raise error.WdirUnsupported | |
1817 | return None |
|
1818 | return None |
@@ -480,8 +480,8 b' def shortesthexnodeidprefix(repo, node, ' | |||||
480 | def isrevsymbol(repo, symbol): |
|
480 | def isrevsymbol(repo, symbol): | |
481 | """Checks if a symbol exists in the repo. |
|
481 | """Checks if a symbol exists in the repo. | |
482 |
|
482 | |||
483 |
See revsymbol() for details. Raises error.LookupError if the |
|
483 | See revsymbol() for details. Raises error.AmbiguousPrefixLookupError if the | |
484 | ambiguous nodeid prefix. |
|
484 | symbol is an ambiguous nodeid prefix. | |
485 | """ |
|
485 | """ | |
486 | try: |
|
486 | try: | |
487 | revsymbol(repo, symbol) |
|
487 | revsymbol(repo, symbol) |
General Comments 0
You need to be logged in to leave comments.
Login now