mercurial/templatekw.py
changeset 37685 76cd5816268e
parent 37503 49a8c2cc7978
child 37686 b1b1b0626f59
equal deleted inserted replaced
37684:5fc502e149f1 37685:76cd5816268e
   791         return 'quiet'
   791         return 'quiet'
   792     elif ui.verbose:
   792     elif ui.verbose:
   793         return 'verbose'
   793         return 'verbose'
   794     return ''
   794     return ''
   795 
   795 
       
   796 @templatekeyword('whyunstable', requires={'repo', 'ctx'})
       
   797 def showwhyunstable(context, mapping):
       
   798     """List of dicts explaining all instabilities of a changeset.
       
   799     (EXPERIMENTAL)
       
   800     """
       
   801     repo = context.resource(mapping, 'repo')
       
   802     ctx = context.resource(mapping, 'ctx')
       
   803 
       
   804     def formatnode(ctx):
       
   805         return ' %s (%s)' % (scmutil.formatchangeid(ctx), ctx.phasestr())
       
   806 
       
   807     entries = obsutil.whyunstable(repo, ctx)
       
   808 
       
   809     for entry in entries:
       
   810         if entry.get('divergentnodes'):
       
   811             dnodes = entry['divergentnodes']
       
   812             entry['divergentnodes'] = ''.join(formatnode(dnode)
       
   813                                               for dnode in dnodes)
       
   814 
       
   815     tmpl = '{instability}:{divergentnodes} {reason} {node|short}'
       
   816     return templateutil.mappinglist(entries, tmpl=tmpl, sep='\n')
       
   817 
   796 def loadkeyword(ui, extname, registrarobj):
   818 def loadkeyword(ui, extname, registrarobj):
   797     """Load template keyword from specified registrarobj
   819     """Load template keyword from specified registrarobj
   798     """
   820     """
   799     for name, func in registrarobj._table.iteritems():
   821     for name, func in registrarobj._table.iteritems():
   800         keywords[name] = func
   822         keywords[name] = func