patch: move import/export wrapping close to the function definition
This gather similar logic together.
--- a/hgext3rd/topic/__init__.py Wed Mar 30 21:53:55 2016 -0700
+++ b/hgext3rd/topic/__init__.py Wed Mar 30 22:02:52 2016 -0700
@@ -345,6 +345,15 @@
if 'topic' in patchdata:
extra['topic'] = patchdata['topic']
+if util.safehasattr(cmdutil, 'extraexport'):
+ cmdutil.extraexport.append('topic')
+ cmdutil.extraexportmap['topic'] = _exporttopic
+if util.safehasattr(cmdutil, 'extrapreimport'):
+ cmdutil.extrapreimport.append('topic')
+ cmdutil.extrapreimportmap['topic'] = _importtopic
+if util.safehasattr(patch, 'patchheadermap'):
+ patch.patchheadermap.append(('EXP-Topic', 'topic'))
+
extensions.afterloaded('rebase', _fixrebase)
entry = extensions.wrapcommand(commands.table, 'commit', commitwrap)
@@ -356,11 +365,3 @@
extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply)
cmdutil.summaryhooks.add('topic', summaryhook)
-if util.safehasattr(cmdutil, 'extraexport'):
- cmdutil.extraexport.append('topic')
- cmdutil.extraexportmap['topic'] = _exporttopic
-if util.safehasattr(cmdutil, 'extrapreimport'):
- cmdutil.extrapreimport.append('topic')
- cmdutil.extrapreimportmap['topic'] = _importtopic
-if util.safehasattr(patch, 'patchheadermap'):
- patch.patchheadermap.append(('EXP-Topic', 'topic'))