##// END OF EJS Templates
templates: add whyunstable template keyword
av6 -
r37703:76cd5816 default
parent child Browse files
Show More
@@ -793,6 +793,28 b' def showverbosity(context, mapping):'
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 """
@@ -721,6 +721,11 b' Use scmutil.cleanupnodes API to create d'
721 $ hg debugwhyunstable 1a2a9b5b0030
721 $ hg debugwhyunstable 1a2a9b5b0030
722 content-divergent: 70d5a63ca112acb3764bc1d7320ca90ea688d671 (draft) predecessor a178212c3433c4e77b573f6011e29affb8aefa33
722 content-divergent: 70d5a63ca112acb3764bc1d7320ca90ea688d671 (draft) predecessor a178212c3433c4e77b573f6011e29affb8aefa33
723
723
724 $ hg log -r 1a2a9b5b0030 --hidden -T '{whyunstable}\n'
725 content-divergent: 4:70d5a63ca112 (draft) predecessor a178212c3433
726 $ hg log -r 1a2a9b5b0030 --hidden -T '{whyunstable%"{instability}:{divergentnodes} {reason} {node}\n"}'
727 content-divergent: 4:70d5a63ca112 (draft) predecessor a178212c3433c4e77b573f6011e29affb8aefa33
728
724 #if serve
729 #if serve
725
730
726 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
731 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
@@ -1044,6 +1044,15 b' test debugwhyunstable output'
1044 orphan: obsolete parent 3de5eca88c00aa039da7399a220f4a5221faa585
1044 orphan: obsolete parent 3de5eca88c00aa039da7399a220f4a5221faa585
1045 phase-divergent: immutable predecessor 245bde4270cd1072a27757984f9cda8ba26f08ca
1045 phase-divergent: immutable predecessor 245bde4270cd1072a27757984f9cda8ba26f08ca
1046
1046
1047 test whyunstable template keyword
1048
1049 $ hg log -r 50c51b361e60 -T '{whyunstable}\n'
1050 orphan: obsolete parent 3de5eca88c00
1051 phase-divergent: immutable predecessor 245bde4270cd
1052 $ hg log -r 50c51b361e60 -T '{whyunstable%"{instability}: {reason} {node}\n"}'
1053 orphan: obsolete parent 3de5eca88c00aa039da7399a220f4a5221faa585
1054 phase-divergent: immutable predecessor 245bde4270cd1072a27757984f9cda8ba26f08ca
1055
1047 #if serve
1056 #if serve
1048
1057
1049 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
1058 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
General Comments 0
You need to be logged in to leave comments. Login now