topic: move function wrapping from reposetup to uisetup
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 12 Dec 2017 01:27:12 +0100
changeset 3281 703e8398ac57
parent 3280 e642bad8174a
child 3282 3675fe74521d
topic: move function wrapping from reposetup to uisetup Having the function un reposetup means they get wrapped over and over again for long lived process.
CHANGELOG
hgext3rd/topic/__init__.py
--- a/CHANGELOG	Tue Dec 12 00:16:55 2017 +0100
+++ b/CHANGELOG	Tue Dec 12 01:27:12 2017 +0100
@@ -25,6 +25,7 @@
 Topic (0.5.2)
 
   * makes code more resilient to partiel initialization
+  * avoid over wrapping inside of long living process
 
 7.0.1 -- 2017-11-14
 -------------------
--- a/hgext3rd/topic/__init__.py	Tue Dec 12 00:16:55 2017 +0100
+++ b/hgext3rd/topic/__init__.py	Tue Dec 12 01:27:12 2017 +0100
@@ -322,6 +322,10 @@
 
     cmdutil.summaryhooks.add('topic', summaryhook)
 
+    # Wrap workingctx extra to return the topic name
+    extensions.wrapfunction(context.workingctx, '__init__', wrapinit)
+    # Wrap changelog.add to drop empty topic
+    extensions.wrapfunction(changelog.changelog, 'add', wrapadd)
 
 def reposetup(ui, repo):
     if not isinstance(repo, localrepo.localrepository):
@@ -483,10 +487,6 @@
         repo.names.addnamespace(namespaces.namespace(
             'topics', 'topic', namemap=_namemap, nodemap=_nodemap,
             listnames=lambda repo: repo.topics))
-    # Wrap workingctx extra to return the topic name
-    extensions.wrapfunction(context.workingctx, '__init__', wrapinit)
-    # Wrap changelog.add to drop empty topic
-    extensions.wrapfunction(changelog.changelog, 'add', wrapadd)
 
 def wrapinit(orig, self, repo, *args, **kwargs):
     orig(self, repo, *args, **kwargs)