Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 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 | bb77654dc7ae |
children | f05ede08dcf7 |
comparison
equal
deleted
inserted
replaced
30693:baee0f47b533 | 30694:5289fd78017a |
---|---|
1140 tempnode2 = None | 1140 tempnode2 = None |
1141 submatch = matchmod.subdirmatcher(subpath, match) | 1141 submatch = matchmod.subdirmatcher(subpath, match) |
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): | |
1146 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()] | |
1147 return ' '.join(labels) | |
1148 | |
1145 class changeset_printer(object): | 1149 class changeset_printer(object): |
1146 '''show changeset information when templating not requested.''' | 1150 '''show changeset information when templating not requested.''' |
1147 | 1151 |
1148 def __init__(self, ui, repo, matchfn, diffopts, buffered): | 1152 def __init__(self, ui, repo, matchfn, diffopts, buffered): |
1149 self.ui = ui | 1153 self.ui = ui |
1200 | 1204 |
1201 date = util.datestr(ctx.date()) | 1205 date = util.datestr(ctx.date()) |
1202 | 1206 |
1203 # i18n: column positioning for "hg log" | 1207 # i18n: column positioning for "hg log" |
1204 self.ui.write(_("changeset: %d:%s\n") % revnode, | 1208 self.ui.write(_("changeset: %d:%s\n") % revnode, |
1205 label='log.changeset changeset.%s' % ctx.phasestr()) | 1209 label=_changesetlabels(ctx)) |
1206 | 1210 |
1207 # branches are shown first before any other names due to backwards | 1211 # branches are shown first before any other names due to backwards |
1208 # compatibility | 1212 # compatibility |
1209 branch = ctx.branch() | 1213 branch = ctx.branch() |
1210 # don't show the default branch name | 1214 # don't show the default branch name |