From patchwork Fri Apr 6 06:58:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 3, evolve-ext] safeguard: use self instead of repo in noautopublishrepo.checkpush() From: Anton Shestakov X-Patchwork-Id: 30425 Message-Id: <86695bae7a72ae1b64ec.1522997916@neuro> To: mercurial-devel@mercurial-scm.org Date: Fri, 06 Apr 2018 14:58:36 +0800 # HG changeset patch # User Anton Shestakov # Date 1522996642 -28800 # Fri Apr 06 14:37:22 2018 +0800 # Node ID 86695bae7a72ae1b64ec6d1fa9370abf473f6544 # Parent ce9f0f1cfbc2bc7fd305625d9da79953fcd43fe1 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). diff --git a/hgext3rd/evolve/safeguard.py b/hgext3rd/evolve/safeguard.py --- a/hgext3rd/evolve/safeguard.py +++ b/hgext3rd/evolve/safeguard.py @@ -25,17 +25,17 @@ def setuppublishprevention(ui, repo): 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")