585 if len(args) > 1: |
585 if len(args) > 1: |
586 minlength = evalinteger(context, mapping, args[1], |
586 minlength = evalinteger(context, mapping, args[1], |
587 # i18n: "shortest" is a keyword |
587 # i18n: "shortest" is a keyword |
588 _("shortest() expects an integer minlength")) |
588 _("shortest() expects an integer minlength")) |
589 |
589 |
590 # _partialmatch() of filtered changelog could take O(len(repo)) time, |
|
591 # which would be unacceptably slow. so we look for hash collision in |
|
592 # unfiltered space, which means some hashes may be slightly longer. |
|
593 repo = context.resource(mapping, 'ctx')._repo |
590 repo = context.resource(mapping, 'ctx')._repo |
594 return scmutil.shortesthexnodeidprefix(repo.unfiltered(), node, minlength) |
591 return scmutil.shortesthexnodeidprefix(repo, node, minlength) |
595 |
592 |
596 @templatefunc('strip(text[, chars])') |
593 @templatefunc('strip(text[, chars])') |
597 def strip(context, mapping, args): |
594 def strip(context, mapping, args): |
598 """Strip characters from a string. By default, |
595 """Strip characters from a string. By default, |
599 strips all leading and trailing whitespace.""" |
596 strips all leading and trailing whitespace.""" |