safeguard: use self instead of repo in noautopublishrepo.checkpush()
authorAnton Shestakov <av6@dwimlabs.net>
Fri, 06 Apr 2018 14:37:22 +0800
changeset 3647 626c5fa0ef07
parent 3646 0dd393a32567
child 3648 ca9fd36b4528
safeguard: use self instead of repo in noautopublishrepo.checkpush() Referring to repo here was somehow preventing it from being garbage-collected (important in hgweb, where currently every request gets a new repo).
hgext3rd/evolve/safeguard.py
--- a/hgext3rd/evolve/safeguard.py	Fri Apr 06 14:36:36 2018 +0800
+++ b/hgext3rd/evolve/safeguard.py	Fri Apr 06 14:37:22 2018 +0800
@@ -25,17 +25,17 @@
 
         def checkpush(self, pushop):
             super(noautopublishrepo, self).checkpush(pushop)
-            behavior = repo.ui.config('experimental', 'auto-publish', 'default')
+            behavior = self.ui.config('experimental', 'auto-publish', 'default')
             remotephases = pushop.remote.listkeys('phases')
             publishing = remotephases.get('publishing', False)
             if behavior in ('warn', 'abort') and publishing:
                 if pushop.revs is None:
-                    published = repo.filtered('served').revs("not public()")
+                    published = self.filtered('served').revs("not public()")
                 else:
-                    published = repo.revs("::%ln - public()", pushop.revs)
+                    published = self.revs("::%ln - public()", pushop.revs)
                 if published:
                     if behavior == 'warn':
-                        repo.ui.warn(_('%i changesets about to be published\n') % len(published))
+                        self.ui.warn(_('%i changesets about to be published\n') % len(published))
                     elif behavior == 'abort':
                         msg = _('push would publish 1 changesets')
                         hint = _("behavior controlled by 'experimental.auto-publish' config")