Mercurial > hg
diff mercurial/templatekw.py @ 37707:24fee31fda05
templates: adjust white space amount in the output of {whyunstable}
There used to be 2 spaces between divergent nodes (when not using custom
template for divergentnodes) because divergentnodes is a hybrid list, which
means it gets ' '.join()ed, but formatnode() already had a space. Now it
doesn't, which requires extra effort in writing custom templates for
whyunstable, but at least it looks correctly by default.
Test output needs to be sorted for stability.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sun, 15 Apr 2018 19:41:34 +0800 |
parents | b1b1b0626f59 |
children | 8808d5d401ee |
line wrap: on
line diff
--- a/mercurial/templatekw.py Sun Apr 15 19:28:01 2018 +0800 +++ b/mercurial/templatekw.py Sun Apr 15 19:41:34 2018 +0800 @@ -802,7 +802,7 @@ ctx = context.resource(mapping, 'ctx') def formatnode(ctx): - return ' %s (%s)' % (scmutil.formatchangeid(ctx), ctx.phasestr()) + return '%s (%s)' % (scmutil.formatchangeid(ctx), ctx.phasestr()) entries = obsutil.whyunstable(repo, ctx) @@ -814,7 +814,8 @@ lambda x: formatnode(repo[x])) entry['divergentnodes'] = dnhybrid - tmpl = '{instability}:{divergentnodes} {reason} {node|short}' + tmpl = ('{instability}:{if(divergentnodes, " ")}{divergentnodes} ' + '{reason} {node|short}') return templateutil.mappinglist(entries, tmpl=tmpl, sep='\n') def loadkeyword(ui, extname, registrarobj):