# HG changeset patch # User Anton Shestakov # Date 1531909036 -28800 # Node ID 28dadd024299d02df4a65884c50a736b1312de1a # Parent 4f147d56980c45450eba654c81e4856857d17dff 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). diff -r 4f147d56980c -r 28dadd024299 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')) ):