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