# HG changeset patch # User Denis Laxalde # Date 1483437401 -3600 # Node ID 5289fd78017acfb5f161d8bb4b0b7f83b6de01e6 # Parent baee0f47b53313e81866c18dd9f740fe52eb3300 cmdutil: extract a _changesetlabels function out of changeset_printer._show() There is a common logic in changeset_printer and in the summary command for labelling a changeset. This prepares extension of changeset's labels with evolution "troubles" information that would show up in both log and summary outputs. Ultimately, both would use this function. diff -r baee0f47b533 -r 5289fd78017a mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Jan 02 14:57:14 2017 +0000 +++ b/mercurial/cmdutil.py Tue Jan 03 10:56:41 2017 +0100 @@ -1142,6 +1142,10 @@ sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, stat=stat, fp=fp, prefix=prefix) +def _changesetlabels(ctx): + labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()] + return ' '.join(labels) + class changeset_printer(object): '''show changeset information when templating not requested.''' @@ -1202,7 +1206,7 @@ # i18n: column positioning for "hg log" self.ui.write(_("changeset: %d:%s\n") % revnode, - label='log.changeset changeset.%s' % ctx.phasestr()) + label=_changesetlabels(ctx)) # branches are shown first before any other names due to backwards # compatibility