##// END OF EJS Templates
revlog: avoid raising no-arg RevlogError for internal flow control...
Martin von Zweigbergk -
r48074:93a0abe0 default
parent child Browse files
Show More
@@ -1538,28 +1538,33 b' class revlog(object):'
1538 def _partialmatch(self, id):
1538 def _partialmatch(self, id):
1539 # we don't care wdirfilenodeids as they should be always full hash
1539 # we don't care wdirfilenodeids as they should be always full hash
1540 maybewdir = self.nodeconstants.wdirhex.startswith(id)
1540 maybewdir = self.nodeconstants.wdirhex.startswith(id)
1541 ambiguous = False
1541 try:
1542 try:
1542 partial = self.index.partialmatch(id)
1543 partial = self.index.partialmatch(id)
1543 if partial and self.hasnode(partial):
1544 if partial and self.hasnode(partial):
1544 if maybewdir:
1545 if maybewdir:
1545 # single 'ff...' match in radix tree, ambiguous with wdir
1546 # single 'ff...' match in radix tree, ambiguous with wdir
1546 raise error.RevlogError
1547 ambiguous = True
1547 return partial
1548 else:
1548 if maybewdir:
1549 return partial
1550 elif maybewdir:
1549 # no 'ff...' match in radix tree, wdir identified
1551 # no 'ff...' match in radix tree, wdir identified
1550 raise error.WdirUnsupported
1552 raise error.WdirUnsupported
1551 return None
1553 else:
1554 return None
1552 except error.RevlogError:
1555 except error.RevlogError:
1553 # parsers.c radix tree lookup gave multiple matches
1556 # parsers.c radix tree lookup gave multiple matches
1554 # fast path: for unfiltered changelog, radix tree is accurate
1557 # fast path: for unfiltered changelog, radix tree is accurate
1555 if not getattr(self, 'filteredrevs', None):
1558 if not getattr(self, 'filteredrevs', None):
1556 raise error.AmbiguousPrefixLookupError(
1559 ambiguous = True
1557 id, self.display_id, _(b'ambiguous identifier')
1558 )
1559 # fall through to slow path that filters hidden revisions
1560 # fall through to slow path that filters hidden revisions
1560 except (AttributeError, ValueError):
1561 except (AttributeError, ValueError):
1561 # we are pure python, or key was too short to search radix tree
1562 # we are pure python, or key was too short to search radix tree
1562 pass
1563 pass
1564 if ambiguous:
1565 raise error.AmbiguousPrefixLookupError(
1566 id, self.display_id, _(b'ambiguous identifier')
1567 )
1563
1568
1564 if id in self._pcache:
1569 if id in self._pcache:
1565 return self._pcache[id]
1570 return self._pcache[id]
General Comments 0
You need to be logged in to leave comments. Login now