Mercurial > hg-stable
changeset 30694:5289fd78017a
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.
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Tue, 03 Jan 2017 10:56:41 +0100 |
parents | baee0f47b533 |
children | f05ede08dcf7 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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