patch: move setup of import/export logic into a function
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 30 Mar 2016 22:05:49 -0700
changeset 1948 54810b543bf4
parent 1947 3458aa1027e6
child 1949 79c08d17a3d7
patch: move setup of import/export logic into a function The function is now called during uisetup.
hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py	Wed Mar 30 22:04:25 2016 -0700
+++ b/hgext3rd/topic/__init__.py	Wed Mar 30 22:05:49 2016 -0700
@@ -90,6 +90,7 @@
     destination.modsetup(ui)
     topicrevset.modsetup(ui)
     discovery.modsetup(ui)
+    setupimportexport(ui)
 
 @contextlib.contextmanager
 def usetopicmap(repo):
@@ -347,11 +348,13 @@
     if 'topic' in patchdata:
         extra['topic'] = patchdata['topic']
 
-cmdutil.extraexport.append('topic')
-cmdutil.extraexportmap['topic'] = _exporttopic
-cmdutil.extrapreimport.append('topic')
-cmdutil.extrapreimportmap['topic'] = _importtopic
-patch.patchheadermap.append(('EXP-Topic', 'topic'))
+def setupimportexport(ui):
+    """run at ui setup time to install import/export logic"""
+    cmdutil.extraexport.append('topic')
+    cmdutil.extraexportmap['topic'] = _exporttopic
+    cmdutil.extrapreimport.append('topic')
+    cmdutil.extrapreimportmap['topic'] = _importtopic
+    patch.patchheadermap.append(('EXP-Topic', 'topic'))
 
 extensions.afterloaded('rebase', _fixrebase)