Mercurial > evolve
changeset 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 | 558dd43b599d |
children | c9cacc62fa17 |
files | src/topic/__init__.py tests/test-topic.t |
diffstat | 2 files changed, 30 insertions(+), 0 deletions(-) [+] |
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
--- 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: