Mercurial > hg
comparison mercurial/revlog.py @ 47155:96ee8ca99f5a
revlog: use revlog.display_id in LookupError
Differential Revision: https://phab.mercurial-scm.org/D10581
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 12:23:27 +0200 |
parents | fbf38517d17d |
children | 3a9f3470922c |
comparison
equal
deleted
inserted
replaced
47154:4532166a50b1 | 47155:96ee8ca99f5a |
---|---|
734 if ( | 734 if ( |
735 node == self.nodeconstants.wdirid | 735 node == self.nodeconstants.wdirid |
736 or node in self.nodeconstants.wdirfilenodeids | 736 or node in self.nodeconstants.wdirfilenodeids |
737 ): | 737 ): |
738 raise error.WdirUnsupported | 738 raise error.WdirUnsupported |
739 raise error.LookupError(node, self._indexfile, _(b'no node')) | 739 raise error.LookupError(node, self.display_id, _(b'no node')) |
740 | 740 |
741 # Accessors for index entries. | 741 # Accessors for index entries. |
742 | 742 |
743 # First tuple entry is 8 bytes. First 6 bytes are offset. Last 2 bytes | 743 # First tuple entry is 8 bytes. First 6 bytes are offset. Last 2 bytes |
744 # are flags. | 744 # are flags. |
1444 return n | 1444 return n |
1445 n = self._partialmatch(id) | 1445 n = self._partialmatch(id) |
1446 if n: | 1446 if n: |
1447 return n | 1447 return n |
1448 | 1448 |
1449 raise error.LookupError(id, self._indexfile, _(b'no match found')) | 1449 raise error.LookupError(id, self.display_id, _(b'no match found')) |
1450 | 1450 |
1451 def shortest(self, node, minlength=1): | 1451 def shortest(self, node, minlength=1): |
1452 """Find the shortest unambiguous prefix that matches node.""" | 1452 """Find the shortest unambiguous prefix that matches node.""" |
1453 | 1453 |
1454 def isvalid(prefix): | 1454 def isvalid(prefix): |
1458 return False | 1458 return False |
1459 except error.WdirUnsupported: | 1459 except error.WdirUnsupported: |
1460 # single 'ff...' match | 1460 # single 'ff...' match |
1461 return True | 1461 return True |
1462 if matchednode is None: | 1462 if matchednode is None: |
1463 raise error.LookupError(node, self._indexfile, _(b'no node')) | 1463 raise error.LookupError(node, self.display_id, _(b'no node')) |
1464 return True | 1464 return True |
1465 | 1465 |
1466 def maybewdir(prefix): | 1466 def maybewdir(prefix): |
1467 return all(c == b'f' for c in pycompat.iterbytestr(prefix)) | 1467 return all(c == b'f' for c in pycompat.iterbytestr(prefix)) |
1468 | 1468 |
1480 length = max(self.index.shortest(node), minlength) | 1480 length = max(self.index.shortest(node), minlength) |
1481 return disambiguate(hexnode, length) | 1481 return disambiguate(hexnode, length) |
1482 except error.RevlogError: | 1482 except error.RevlogError: |
1483 if node != self.nodeconstants.wdirid: | 1483 if node != self.nodeconstants.wdirid: |
1484 raise error.LookupError( | 1484 raise error.LookupError( |
1485 node, self._indexfile, _(b'no node') | 1485 node, self.display_id, _(b'no node') |
1486 ) | 1486 ) |
1487 except AttributeError: | 1487 except AttributeError: |
1488 # Fall through to pure code | 1488 # Fall through to pure code |
1489 pass | 1489 pass |
1490 | 1490 |
2459 continue | 2459 continue |
2460 | 2460 |
2461 for p in (p1, p2): | 2461 for p in (p1, p2): |
2462 if not self.index.has_node(p): | 2462 if not self.index.has_node(p): |
2463 raise error.LookupError( | 2463 raise error.LookupError( |
2464 p, self._indexfile, _(b'unknown parent') | 2464 p, self.radix, _(b'unknown parent') |
2465 ) | 2465 ) |
2466 | 2466 |
2467 if not self.index.has_node(deltabase): | 2467 if not self.index.has_node(deltabase): |
2468 raise error.LookupError( | 2468 raise error.LookupError( |
2469 deltabase, self._indexfile, _(b'unknown delta base') | 2469 deltabase, self.display_id, _(b'unknown delta base') |
2470 ) | 2470 ) |
2471 | 2471 |
2472 baserev = self.rev(deltabase) | 2472 baserev = self.rev(deltabase) |
2473 | 2473 |
2474 if baserev != nullrev and self.iscensored(baserev): | 2474 if baserev != nullrev and self.iscensored(baserev): |