changeset 1945:f4f5bf8b4d17

patch: move import/export wrapping close to the function definition This gather similar logic together.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 30 Mar 2016 22:02:52 -0700
parents daad8249d5cf
children 72246b13bd72
files hgext3rd/topic/__init__.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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'))