##// END OF EJS Templates
shortest: make pure code also disambigute against revnums at end...
Martin von Zweigbergk -
r37988:0db7fe7c default
parent child Browse files
Show More
@@ -1542,31 +1542,22 b' class revlog(object):'
1542 length = max(self.index.shortest(node), minlength)
1542 length = max(self.index.shortest(node), minlength)
1543 return disambiguate(hexnode, length)
1543 return disambiguate(hexnode, length)
1544 except RevlogError:
1544 except RevlogError:
1545 if node == wdirid:
1545 if node != wdirid:
1546 for length in range(minlength, 41):
1547 prefix = hexnode[:length]
1548 if isvalid(prefix):
1549 return prefix
1550 else:
1551 raise LookupError(node, self.indexfile, _('no node'))
1546 raise LookupError(node, self.indexfile, _('no node'))
1552 except AttributeError:
1547 except AttributeError:
1553 # Fall through to pure code
1548 # Fall through to pure code
1554 pass
1549 pass
1555
1550
1556 shortest = hexnode
1551 if node == wdirid:
1557 startlength = max(6, minlength)
1552 for length in range(minlength, 41):
1558 length = startlength
1553 prefix = hexnode[:length]
1559 while True:
1554 if isvalid(prefix):
1555 return prefix
1556
1557 for length in range(minlength, 41):
1560 prefix = hexnode[:length]
1558 prefix = hexnode[:length]
1561 if isvalid(prefix):
1559 if isvalid(prefix):
1562 shortest = prefix
1560 return disambiguate(hexnode, length)
1563 if length == minlength or length > startlength:
1564 return shortest
1565 length -= 1
1566 else:
1567 length += 1
1568 if len(shortest) <= length:
1569 return shortest
1570
1561
1571 def cmp(self, node, text):
1562 def cmp(self, node, text):
1572 """compare text with a given file revision
1563 """compare text with a given file revision
General Comments 0
You need to be logged in to leave comments. Login now