##// END OF EJS Templates
revlog: make shortest() take a full binary nodeid (API)...
Martin von Zweigbergk -
r37785:44d1959a default
parent child Browse files
Show More
@@ -1500,8 +1500,8 class revlog(object):
1500 1500
1501 1501 raise LookupError(id, self.indexfile, _('no match found'))
1502 1502
1503 def shortest(self, hexnode, minlength=1):
1504 """Find the shortest unambiguous prefix that matches hexnode."""
1503 def shortest(self, node, minlength=1):
1504 """Find the shortest unambiguous prefix that matches node."""
1505 1505 def isvalid(test):
1506 1506 try:
1507 1507 if self._partialmatch(test) is None:
@@ -1523,6 +1523,7 class revlog(object):
1523 1523 # single 'ff...' match
1524 1524 return True
1525 1525
1526 hexnode = hex(node)
1526 1527 shortest = hexnode
1527 1528 startlength = max(6, minlength)
1528 1529 length = startlength
@@ -448,7 +448,7 def shortesthexnodeidprefix(repo, node,
448 448 # _partialmatch() of filtered changelog could take O(len(repo)) time,
449 449 # which would be unacceptably slow. so we look for hash collision in
450 450 # unfiltered space, which means some hashes may be slightly longer.
451 return repo.unfiltered().changelog.shortest(hex(node), minlength)
451 return repo.unfiltered().changelog.shortest(node, minlength)
452 452
453 453 def isrevsymbol(repo, symbol):
454 454 """Checks if a symbol exists in the repo.
General Comments 0
You need to be logged in to leave comments. Login now