mercurial/templatefuncs.py
changeset 37708 8e8541610d85
parent 37680 e743b8524d60
child 37709 7b2955624777
equal deleted inserted replaced
37707:24fee31fda05 37708:8e8541610d85
   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."""