fastmanifest: drop global uiproxy

Summary:
fastmanifest uses a `uiproxy` semi-global variable to workaround a chg issue
where `uisetup` received an out-of-date `ui` object.

That's no longer necessary D7840237. Removing the `uiproxy` global variable
fixes the memory leak.

Reviewed By: chadaustin

Differential Revision: D8676285

fbshipit-source-id: a5e042e4f61460ce53d43a231f07d70f27a52f19
This commit is contained in:
Jun Wu 2018-06-28 14:08:47 -07:00 committed by Facebook Github Bot
parent e4ff05e792
commit 9aca1a1da1
2 changed files with 5 additions and 33 deletions

View File

@ -188,22 +188,8 @@ def cachemanifest(ui, repo, *pats, **opts):
cachemanager.cacher.cachemanifest(repo)
class uiproxy(object):
"""This is a proxy object that forwards all requests to a real ui object."""
def __init__(self, ui):
self.ui = ui
def _updateui(self, ui):
self.ui = ui
def __getattr__(self, name):
return getattr(self.ui, name)
class FastManifestExtension(object):
initialized = False
uiproxy = uiproxy(None)
@staticmethod
def _logonexit(orig, ui, repo, cmd, fullargs, *args):
@ -212,16 +198,7 @@ class FastManifestExtension(object):
return r
@staticmethod
def get_ui():
return FastManifestExtension.uiproxy
@staticmethod
def set_ui(ui):
FastManifestExtension.uiproxy._updateui(ui)
@staticmethod
def setup():
ui = FastManifestExtension.get_ui()
def setup(ui):
logger = debug.manifestaccesslogger(ui)
extensions.wrapfunction(manifest.manifestrevlog, "rev", logger.revwrap)
@ -269,11 +246,7 @@ class FastManifestExtension(object):
def extsetup(ui):
# always update the ui object. this is probably a bogus ui object, but we
# don't want to have a backing ui object of None.
FastManifestExtension.set_ui(ui)
FastManifestExtension.setup()
FastManifestExtension.setup(ui)
def reposetup(ui, repo):
@ -282,9 +255,6 @@ def reposetup(ui, repo):
if repo.local() is None:
return
# always update the ui object.
FastManifestExtension.set_ui(ui)
if ui.configbool("fastmanifest", "usetree"):
try:
extensions.find("treemanifest")

View File

@ -46,15 +46,17 @@ Problematic extension: remotefilelog
$ hg log -r . -T '{manifest % "{node}"}\n'
0000000000000000000000000000000000000000
Problematic extension: treemanifest and fastmanifest
Fine extension: treemanifest and fastmanifest
$ newrepo
__del__ called
$ setconfig extensions.treemanifest= extensions.fastmanifest= remotefilelog.reponame=x
$ hg log -r . -T '{node}\n'
0000000000000000000000000000000000000000
__del__ called
$ hg log -r . -T '{manifest % "{node}"}\n'
0000000000000000000000000000000000000000
__del__ called
Fine extension: treemanifest only