##// END OF EJS Templates
templater: use unfiltered changelog to calculate shortest() at constant time...
Yuya Nishihara -
r30232:362740e0 stable
parent child Browse files
Show More
@@ -837,7 +837,10 b' def shortest(context, mapping, args):'
837 837 # i18n: "shortest" is a keyword
838 838 _("shortest() expects an integer minlength"))
839 839
840 cl = mapping['ctx']._repo.changelog
840 # _partialmatch() of filtered changelog could take O(len(repo)) time,
841 # which would be unacceptably slow. so we look for hash collision in
842 # unfiltered space, which means some hashes may be slightly longer.
843 cl = mapping['ctx']._repo.unfiltered().changelog
841 844 def isvalid(test):
842 845 try:
843 846 if cl._partialmatch(test) is None:
@@ -3469,9 +3469,10 b' Test shortest(node) with the repo having'
3469 3469 4:107
3470 3470
3471 3471 node 'c562' should be unique if the other 'c562' nodes are hidden
3472 (but we don't try the slow path to filter out hidden nodes for now)
3472 3473
3473 3474 $ hg log -r 8 -T '{rev}:{node|shortest}\n'
3474 8:c562
3475 8:c5625
3475 3476 $ hg log -r 8:10 -T '{rev}:{node|shortest}\n' --hidden
3476 3477 8:c5625
3477 3478 9:c5623
General Comments 0
You need to be logged in to leave comments. Login now