[PATCH] store: eliminate reference cycle in fncachestore
Simon Heimberg
simohe at besonet.ch
Tue Jul 14 07:08:41 CDT 2009
# 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
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)
+ 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):
More information about the Mercurial-devel
mailing list