[PATCH] store: eliminate reference cycle in fncachestore
Adrian Buehlmann
adrian at cadifra.com
Tue Jul 14 17:11:25 CDT 2009
On 14.07.2009 14:08, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1247573107 -7200
> # Node ID 0a8f2362bab49d934482a33410119a7a32e19c15
> # Parent 01450cb02c41b0276ed4f273a8a15555f763da95
> store: eliminate reference cycle in fncachestore
>
> no reference to self in fncacheopener
> Inspired by Adrian Buehlmann
Thanks for that, but this is not needed.
This is your patch.
> diff -r 01450cb02c41 -r 0a8f2362bab4 mercurial/store.py
> --- a/mercurial/store.py Die Jul 14 14:05:01 2009 +0200
> +++ b/mercurial/store.py Die Jul 14 14:05:07 2009 +0200
> @@ -284,16 +284,17 @@
> self.pathjoiner = pathjoiner
> self.path = self.pathjoiner(path, 'store')
> self.createmode = _calcmode(self.path)
> - self._op = opener(self.path)
> - self._op.createmode = self.createmode
> - self.fncache = fncache(self._op)
> + op = opener(self.path)
> + op.createmode = self.createmode
> + fn_cache = fncache(op)
utter nitpick: how about using 'fnc' instead of 'fn_cache'?
> + self.fncache = fn_cache
>
> def fncacheopener(path, mode='r', *args, **kw):
> if (mode not in ('r', 'rb')
> and path.startswith('data/')
> - and path not in self.fncache):
> - self.fncache.add(path)
> - return self._op(hybridencode(path), mode, *args, **kw)
> + and path not in fn_cache):
> + fn_cache.add(path)
> + return op(hybridencode(path), mode, *args, **kw)
> self.opener = fncacheopener
>
> def join(self, f):
otherwise looks good. Did you run the testsuite, Simon?
This might even go into -stable
More information about the Mercurial-devel
mailing list