##// 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 raise LookupError(id, self.indexfile, _('no match found'))
1501 raise LookupError(id, self.indexfile, _('no match found'))
1502
1502
1503 def shortest(self, hexnode, minlength=1):
1503 def shortest(self, node, minlength=1):
1504 """Find the shortest unambiguous prefix that matches hexnode."""
1504 """Find the shortest unambiguous prefix that matches node."""
1505 def isvalid(test):
1505 def isvalid(test):
1506 try:
1506 try:
1507 if self._partialmatch(test) is None:
1507 if self._partialmatch(test) is None:
@@ -1523,6 +1523,7 class revlog(object):
1523 # single 'ff...' match
1523 # single 'ff...' match
1524 return True
1524 return True
1525
1525
1526 hexnode = hex(node)
1526 shortest = hexnode
1527 shortest = hexnode
1527 startlength = max(6, minlength)
1528 startlength = max(6, minlength)
1528 length = startlength
1529 length = startlength
@@ -448,7 +448,7 def shortesthexnodeidprefix(repo, node,
448 # _partialmatch() of filtered changelog could take O(len(repo)) time,
448 # _partialmatch() of filtered changelog could take O(len(repo)) time,
449 # which would be unacceptably slow. so we look for hash collision in
449 # which would be unacceptably slow. so we look for hash collision in
450 # unfiltered space, which means some hashes may be slightly longer.
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 def isrevsymbol(repo, symbol):
453 def isrevsymbol(repo, symbol):
454 """Checks if a symbol exists in the repo.
454 """Checks if a symbol exists in the repo.
General Comments 0
You need to be logged in to leave comments. Login now