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

Sean Farley sean.michael.farley at gmail.com
Mon Aug 18 16:18:03 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at 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.

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:


More information about the Mercurial-devel mailing list