summary: add topic summary hook
authorMatt Mackall <mpm@selenic.com>
Wed, 10 Jun 2015 16:32:20 -0500
changeset 1848 9a81657deec2
parent 1847 9fa5b8f4e98e
child 1849 9218f91619f6
summary: add topic summary hook
src/topic/__init__.py
--- 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)