# 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 --git a/src/topic/__init__.py b/src/topic/__init__.py --- a/src/topic/__init__.py +++ b/src/topic/__init__.py @@ -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 --git a/tests/test-topic.t b/tests/test-topic.t --- a/tests/test-topic.t +++ b/tests/test-topic.t @@ -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: