Patchwork [07,of,12] cmdutil: use repo.labels instead of accessing tags and bookmarks directly

login
register
mail settings
Submitter Sean Farley
Date Aug. 18, 2014, 9:18 p.m.
Message ID <80fe2f84bc7a0d327aac.1408396683@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/5465/
State Changes Requested
Headers show

Comments

Sean Farley - Aug. 18, 2014, 9:18 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# 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.

Patch

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: