mercurial/templatekw.py
changeset 37707 24fee31fda05
parent 37686 b1b1b0626f59
child 37908 8808d5d401ee
equal deleted inserted replaced
37706:04b89360913c 37707:24fee31fda05
   800     """
   800     """
   801     repo = context.resource(mapping, 'repo')
   801     repo = context.resource(mapping, 'repo')
   802     ctx = context.resource(mapping, 'ctx')
   802     ctx = context.resource(mapping, 'ctx')
   803 
   803 
   804     def formatnode(ctx):
   804     def formatnode(ctx):
   805         return ' %s (%s)' % (scmutil.formatchangeid(ctx), ctx.phasestr())
   805         return '%s (%s)' % (scmutil.formatchangeid(ctx), ctx.phasestr())
   806 
   806 
   807     entries = obsutil.whyunstable(repo, ctx)
   807     entries = obsutil.whyunstable(repo, ctx)
   808 
   808 
   809     for entry in entries:
   809     for entry in entries:
   810         if entry.get('divergentnodes'):
   810         if entry.get('divergentnodes'):
   812             dnhybrid = _hybrid(None, [dnode.hex() for dnode in dnodes],
   812             dnhybrid = _hybrid(None, [dnode.hex() for dnode in dnodes],
   813                                lambda x: {'ctx': repo[x]},
   813                                lambda x: {'ctx': repo[x]},
   814                                lambda x: formatnode(repo[x]))
   814                                lambda x: formatnode(repo[x]))
   815             entry['divergentnodes'] = dnhybrid
   815             entry['divergentnodes'] = dnhybrid
   816 
   816 
   817     tmpl = '{instability}:{divergentnodes} {reason} {node|short}'
   817     tmpl = ('{instability}:{if(divergentnodes, " ")}{divergentnodes} '
       
   818             '{reason} {node|short}')
   818     return templateutil.mappinglist(entries, tmpl=tmpl, sep='\n')
   819     return templateutil.mappinglist(entries, tmpl=tmpl, sep='\n')
   819 
   820 
   820 def loadkeyword(ui, extname, registrarobj):
   821 def loadkeyword(ui, extname, registrarobj):
   821     """Load template keyword from specified registrarobj
   822     """Load template keyword from specified registrarobj
   822     """
   823     """