topic: use self instead of repo in topicrepo methods stable
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 18 Jul 2018 18:17:16 +0800
branchstable
changeset 3880 28dadd024299
parent 3835 4f147d56980c
child 3898 93d9cde93b82
topic: use self instead of repo in topicrepo methods Referring to repo here was somehow preventing it from being garbage-collected (important in hgweb, where currently every request gets a new repo).
hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py	Mon Jun 11 23:31:44 2018 +0530
+++ b/hgext3rd/topic/__init__.py	Wed Jul 18 18:17:16 2018 +0800
@@ -364,7 +364,7 @@
         def commit(self, *args, **kwargs):
             backup = self.ui.backupconfig('ui', 'allowemptycommit')
             try:
-                if repo.currenttopic != repo['.'].topic():
+                if self.currenttopic != self['.'].topic():
                     # bypass the core "nothing changed" logic
                     self.ui.setconfig('ui', 'allowemptycommit', True)
                 return super(topicrepo, self).commit(*args, **kwargs)
@@ -374,7 +374,7 @@
         def commitctx(self, ctx, error=None):
             topicfilter = topicmap.topicfilter(self.filtername)
             if topicfilter != self.filtername:
-                other = repo.filtered(topicmap.topicfilter(repo.filtername))
+                other = self.filtered(topicmap.topicfilter(self.filtername))
                 other.commitctx(ctx, error=error)
 
             if isinstance(ctx, context.workingcommitctx):
@@ -409,7 +409,7 @@
 
         def branchmap(self, topic=None):
             if topic is None:
-                topic = getattr(repo, '_autobranchmaptopic', False)
+                topic = getattr(self, '_autobranchmaptopic', False)
             topicfilter = topicmap.topicfilter(self.filtername)
             if not topic or topicfilter == self.filtername:
                 return super(topicrepo, self).branchmap()
@@ -437,7 +437,7 @@
                 return tr
 
             reporef = weakref.ref(self)
-            if repo.ui.configbool('experimental', 'enforce-single-head'):
+            if self.ui.configbool('experimental', 'enforce-single-head'):
                 origvalidator = tr.validator
 
                 def validator(tr2):
@@ -446,7 +446,7 @@
                     origvalidator(tr2)
                 tr.validator = validator
 
-            topicmodeserver = repo.ui.config('experimental',
+            topicmodeserver = self.ui.config('experimental',
                                              'topic-mode.server', 'ignore')
             ispush = (desc.startswith('push') or desc.startswith('serve'))
             if (topicmodeserver != 'ignore' and ispush):
@@ -458,7 +458,7 @@
                     return origvalidator(tr2)
                 tr.validator = validator
 
-            elif (repo.ui.configbool('experimental', 'topic.publish-bare-branch')
+            elif (self.ui.configbool('experimental', 'topic.publish-bare-branch')
                     and (desc.startswith('push')
                          or desc.startswith('serve'))
                     ):