diff src/topic/__init__.py @ 1866:13fc93fb7fbe

patch: add topic to exported patch If used Mercurial supports it, we add a topic header to patches.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 08 Oct 2015 20:42:26 -0700
parents 29fc43f24948
children c9cacc62fa17
line wrap: on
line diff
--- a/src/topic/__init__.py	Wed Oct 14 12:09:11 2015 -0400
+++ b/src/topic/__init__.py	Thu Oct 08 20:42:26 2015 -0700
@@ -213,6 +213,12 @@
     rebase = extensions.find("rebase")
     extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn)
 
+def _exporttopic(seq, ctx):
+    topic = ctx.topic()
+    if topic:
+        return 'EXP-Topic %s'  % topic
+    return None
+
 extensions.afterloaded('rebase', _fixrebase)
 
 entry = extensions.wrapcommand(commands.table, 'commit', commitwrap)
@@ -223,3 +229,7 @@
 extensions.wrapfunction(merge, 'update', mergeupdatewrap)
 topicrevset.modsetup()
 cmdutil.summaryhooks.add('topic', summaryhook)
+
+if util.safehasattr(cmdutil, 'extraexport'):
+    cmdutil.extraexport.append('topic')
+    cmdutil.extraexportmap['topic'] = _exporttopic