mercurial/templatefuncs.py
changeset 37325 41a5d815d2c1
parent 37277 9e8128e84326
child 37327 ebf139cbd4a1
equal deleted inserted replaced
37324:c2f74b8f6b7f 37325:41a5d815d2c1
   322     joinset = templateutil.unwrapvalue(context, mapping, joinset)
   322     joinset = templateutil.unwrapvalue(context, mapping, joinset)
   323     joinfmt = getattr(joinset, 'joinfmt', pycompat.identity)
   323     joinfmt = getattr(joinset, 'joinfmt', pycompat.identity)
   324     joiner = " "
   324     joiner = " "
   325     if len(args) > 1:
   325     if len(args) > 1:
   326         joiner = evalstring(context, mapping, args[1])
   326         joiner = evalstring(context, mapping, args[1])
   327 
   327     itemiter = (joinfmt(x) for x in pycompat.maybebytestr(joinset))
   328     first = True
   328     return templateutil.joinitems(itemiter, joiner)
   329     for x in pycompat.maybebytestr(joinset):
       
   330         if first:
       
   331             first = False
       
   332         else:
       
   333             yield joiner
       
   334         yield joinfmt(x)
       
   335 
   329 
   336 @templatefunc('label(label, expr)')
   330 @templatefunc('label(label, expr)')
   337 def label(context, mapping, args):
   331 def label(context, mapping, args):
   338     """Apply a label to generated content. Content with
   332     """Apply a label to generated content. Content with
   339     a label applied can result in additional post-processing, such as
   333     a label applied can result in additional post-processing, such as