[PATCH 2 of 3] store: eliminate reference cycle in fncachestore
Adrian Buehlmann
adrian at cadifra.com
Mon Jul 13 15:42:45 CDT 2009
On 13.07.2009 16:15, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1247241244 -7200
> # Node ID d0d02a480e6a65cac1c86f7e74445c3e71ed173a
> # Parent a9ab0e06c244d08c1308b843d8b3385e9051788e
> store: eliminate reference cycle in fncachestore
>
> override method instead of passing a bound method
> pass defversion in store because it is not possible to add a property to a
> method
>
I'm currently pondering:
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -284,16 +284,16 @@ class fncachestore(basicstore):
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
+ self.fncache = fncache(op)
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)
+ return op(hybridencode(path), mode, *args, **kw)
self.opener = fncacheopener
def join(self, f):
Would this eliminate the cycle(s)?
It looks like we don't need to keep the opener as a data attribute
anyway.
More information about the Mercurial-devel
mailing list