From patchwork Mon Aug 18 21:18:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [07, of, 12] cmdutil: use repo.labels instead of accessing tags and bookmarks directly From: Sean Farley X-Patchwork-Id: 5465 Message-Id: <80fe2f84bc7a0d327aac.1408396683@1.0.0.127.in-addr.arpa> To: mercurial-devel@selenic.com Date: Mon, 18 Aug 2014 16:18:03 -0500 # HG changeset patch # User Sean Farley # Date 1396220329 18000 # Sun Mar 30 17:58:49 2014 -0500 # Node ID 80fe2f84bc7a0d327aac7456eec8e996a3d3488d # Parent 8e603b1775c5645f0f77abe6e0671c9ecc5eb0c6 cmdutil: use repo.labels instead of accessing tags and bookmarks directly We can now use the first benefit of repo.labels by placing them automatically in the log output. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -872,18 +872,14 @@ class changeset_printer(object): # don't show the default branch name if branch != 'default': # i18n: column positioning for "hg log" self.ui.write(_("branch: %s\n") % branch, label='log.branch') - for bookmark in self.repo.nodebookmarks(changenode): + for name, mtype in self.repo.nodelabels(changenode): # i18n: column positioning for "hg log" - self.ui.write(_("bookmark: %s\n") % bookmark, - label='log.bookmark') - for tag in self.repo.nodetags(changenode): - # i18n: column positioning for "hg log" - self.ui.write(_("tag: %s\n") % tag, - label='log.tag') + self.ui.write(_(("%s:" % mtype).ljust(13) + "%s\n") % name, + label='log.%s' % mtype) if self.ui.debugflag and ctx.phase(): # i18n: column positioning for "hg log" self.ui.write(_("phase: %s\n") % _(ctx.phasestr()), label='log.phase') for parent in parents: