diff src/topic/__init__.py @ 1852:3084687f7994

commit: add a topic field to the in-editor commit text
author Matt Mackall <mpm@selenic.com>
date Wed, 10 Jun 2015 17:52:07 -0500
parents 67d53e8e0c1a
children 8db7828751b7
line wrap: on
line diff
--- a/src/topic/__init__.py	Wed Jun 10 17:40:50 2015 -0500
+++ b/src/topic/__init__.py	Wed Jun 10 17:52:07 2015 -0500
@@ -134,6 +134,14 @@
             f.write(t)
     return orig(ui, repo, *args, **opts)
 
+def committextwrap(orig, repo, ctx, subs, extramsg):
+    ret = orig(repo, ctx, subs, extramsg)
+    t = repo.currenttopic
+    if t:
+        ret = ret.replace("\nHG: branch",
+                          "\nHG: topic '%s'\nHG: branch" % t)
+    return ret
+
 def updatewrap(orig, ui, repo, *args, **kwargs):
     ret = orig(ui, repo, *args, **kwargs)
     pctx = repo['.']
@@ -155,5 +163,6 @@
                  _("use specified topic"), _('TOPIC')))
 
 extensions.wrapcommand(commands.table, 'update', updatewrap)
+extensions.wrapfunction(cmdutil, 'buildcommittext', committextwrap)
 topicrevset.modsetup()
 cmdutil.summaryhooks.add('topic', summaryhook)