--- a/src/topic/__init__.py Wed Jun 10 16:44:49 2015 -0500
+++ b/src/topic/__init__.py Wed Jun 10 17:13:15 2015 -0500
@@ -128,6 +128,13 @@
# i18n: column positioning for "hg summary"
ui.write(_("topic: %s\n") % t)
+def commitwrap(orig, ui, repo, *args, **opts):
+ if opts.get('topic'):
+ t = opts['topic']
+ with repo.vfs.open('topic', 'w') as f:
+ f.write(t)
+ return orig(ui, repo, *args, **opts)
+
def updatewrap(orig, ui, repo, *args, **kwargs):
ret = orig(ui, repo, *args, **kwargs)
pctx = repo['.']
@@ -144,6 +151,10 @@
ui.status(_("switching to topic %s\n") % t)
return ret
+entry = extensions.wrapcommand(commands.table, 'commit', commitwrap)
+entry[1].append(('t', 'topic', '',
+ _("use specified topic"), _('TOPIC')))
+
extensions.wrapcommand(commands.table, 'update', updatewrap)
topicrevset.modsetup()
cmdutil.summaryhooks.add('topic', summaryhook)