changeset 1848:9a81657deec2

summary: add topic summary hook
author Matt Mackall <mpm@selenic.com>
date Wed, 10 Jun 2015 16:32:20 -0500
parents 9fa5b8f4e98e
children 9218f91619f6
files src/topic/__init__.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/topic/__init__.py	Wed Jun 10 16:23:56 2015 -0500
+++ b/src/topic/__init__.py	Wed Jun 10 16:32:20 2015 -0500
@@ -12,6 +12,7 @@
 """
 import functools
 
+from mercurial.i18n import _
 from mercurial import cmdutil
 from mercurial import commands
 from mercurial import context
@@ -120,6 +121,12 @@
         marker = '*' if t == current else ' '
         ui.write(' %s %s\n' % (marker, t))
 
+def summaryhook(ui, repo):
+    t = repo.currenttopic
+    if not t:
+        return
+    # i18n: column positioning for "hg summary"
+    ui.write(_("topic:  %s\n") % t)
 
 def updatewrap(orig, ui, repo, *args, **kwargs):
     ret = orig(ui, repo, *args, **kwargs)
@@ -136,3 +143,4 @@
 
 extensions.wrapcommand(commands.table, 'update', updatewrap)
 topicrevset.modsetup()
+cmdutil.summaryhooks.add('topic', summaryhook)