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.
--- 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)