# HG changeset patch # User Pierre-Yves David # Date 1444362146 25200 # Node ID 13fc93fb7fbeecebe566c0a34746b13692073e6f # Parent 558dd43b599d6858f0f298caa698742490069c2c patch: add topic to exported patch If used Mercurial supports it, we add a topic header to patches. diff -r 558dd43b599d -r 13fc93fb7fbe src/topic/__init__.py --- 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 diff -r 558dd43b599d -r 13fc93fb7fbe tests/test-topic.t --- a/tests/test-topic.t Wed Oct 14 12:09:11 2015 -0400 +++ b/tests/test-topic.t Thu Oct 08 20:42:26 2015 -0700 @@ -137,6 +137,26 @@ adding manifests adding file changes added 5 changesets with 5 changes to 4 files + +Export + + $ hg -R pinky export + # HG changeset patch + # User test + # Date 0 0 + # Thu Jan 01 00:00:00 1970 +0000 + # Node ID 7c34953036d6a36eae468c550d0592b89ee8bffc + # Parent fb147b0b417c25ca15547cd945acf51cf8dcaf02 + # EXP-Topic narf + narf! + + diff -r fb147b0b417c -r 7c34953036d6 alpha + --- a/alpha Thu Jan 01 00:00:00 1970 +0000 + +++ b/alpha Thu Jan 01 00:00:00 1970 +0000 + @@ -1,2 +1,3 @@ + file alpha + topic work + +narf!!! Now that we've pushed to brain, the work done on narf is no longer a draft, so we won't see that topic name anymore: