changeset 1948:54810b543bf4

patch: move setup of import/export logic into a function The function is now called during uisetup.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 30 Mar 2016 22:05:49 -0700
parents 3458aa1027e6
children 79c08d17a3d7
files hgext3rd/topic/__init__.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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)