comparison mercurial/cmdutil.py @ 30695:f05ede08dcf7

cmdutil: add support for evolution "troubles" display in changeset_printer Add a "trouble" line in changeset header along with a couple of labels on "log.changeset" line to indicate whether a changeset is troubled or not and which kind trouble occurs.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Mon, 10 Oct 2016 12:06:58 +0200
parents 5289fd78017a
children 5c85c93cdd61
comparison
equal deleted inserted replaced
30694:5289fd78017a 30695:f05ede08dcf7
1142 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, 1142 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
1143 stat=stat, fp=fp, prefix=prefix) 1143 stat=stat, fp=fp, prefix=prefix)
1144 1144
1145 def _changesetlabels(ctx): 1145 def _changesetlabels(ctx):
1146 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()] 1146 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
1147 if ctx.troubled():
1148 labels.append('changeset.troubled')
1149 for trouble in ctx.troubles():
1150 labels.append('trouble.%s' % trouble)
1147 return ' '.join(labels) 1151 return ' '.join(labels)
1148 1152
1149 class changeset_printer(object): 1153 class changeset_printer(object):
1150 '''show changeset information when templating not requested.''' 1154 '''show changeset information when templating not requested.'''
1151 1155
1249 self.ui.write(_("user: %s\n") % ctx.user(), 1253 self.ui.write(_("user: %s\n") % ctx.user(),
1250 label='log.user') 1254 label='log.user')
1251 # i18n: column positioning for "hg log" 1255 # i18n: column positioning for "hg log"
1252 self.ui.write(_("date: %s\n") % date, 1256 self.ui.write(_("date: %s\n") % date,
1253 label='log.date') 1257 label='log.date')
1258
1259 if ctx.troubled():
1260 self.ui.write(_("trouble: %s\n") % ', '.join(ctx.troubles()),
1261 label='ui.note log.trouble')
1254 1262
1255 if self.ui.debugflag: 1263 if self.ui.debugflag:
1256 files = ctx.p1().status(ctx)[:3] 1264 files = ctx.p1().status(ctx)[:3]
1257 for key, value in zip([# i18n: column positioning for "hg log" 1265 for key, value in zip([# i18n: column positioning for "hg log"
1258 _("files:"), 1266 _("files:"),