Mercurial > hg
changeset 14194:3a90fb3addc1
store: break up reference cycle introduced in 9cbff8a39a2a
see also 996c1cd8f530
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Wed, 04 May 2011 12:58:59 +0200 |
parents | c4de16642861 |
children | 0013d3eeb826 |
files | mercurial/store.py |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/store.py Wed May 04 10:32:08 2011 -0500 +++ b/mercurial/store.py Wed May 04 12:58:59 2011 +0200 @@ -365,26 +365,27 @@ self._load() return iter(self.entries) +class _fncacheopener(scmutil.abstractopener): + def __init__(self, op, fnc, encode): + self.opener = op + self.fncache = fnc + self.encode = encode + + def __call__(self, path, mode='r', *args, **kw): + if mode not in ('r', 'rb') and path.startswith('data/'): + self.fncache.add(path) + return self.opener(self.encode(path), mode, *args, **kw) + class fncachestore(basicstore): def __init__(self, path, openertype, encode): self.encode = encode self.path = path + '/store' self.createmode = _calcmode(self.path) - - storeself = self - - class fncacheopener(openertype): - def __call__(self, path, mode='r', *args, **kw): - if mode not in ('r', 'rb') and path.startswith('data/'): - fnc.add(path) - return openertype.__call__(self, storeself.encode(path), mode, - *args, **kw) - - op = fncacheopener(self.path) + op = openertype(self.path) op.createmode = self.createmode fnc = fncache(op) self.fncache = fnc - self.opener = op + self.opener = _fncacheopener(op, fnc, encode) def join(self, f): return self.path + '/' + self.encode(f)