# HG changeset patch # User Martin von Zweigbergk # Date 1426135008 25200 # Node ID f78252429e0aff26196c096fd17460ae8adf86f0 # Parent 40528ad1b1e8a00f1a952ba8d26a44bcba7a5ec1 largefiles: don't create chain of __contains__ calls Matt Harbison pointed out that my recent 2720f967a7b1 might cause __contains__ to continously get replaced by another version that calls itself, since the manifest instance returned by the super method is always the same instance due to @propertycache. He also suggested replacing the class instead, as is done with the context class in the surrounding code. Do so. diff -r 40528ad1b1e8 -r f78252429e0a hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py Thu Mar 12 09:06:45 2015 -0700 +++ b/hgext/largefiles/reposetup.py Wed Mar 11 21:36:48 2015 -0700 @@ -44,11 +44,12 @@ return [lfutil.splitstandin(f) or f for f in filenames] def manifest(self): man1 = super(lfilesctx, self).manifest() - orig = man1.__contains__ - def __contains__(self, filename): - return (orig(filename) or - orig(lfutil.standin(filename))) - man1.__contains__ = __contains__.__get__(man1) + class lfilesmanifest(man1.__class): + def __contains__(self, filename): + orig = super(lfilesmanifest, self).__contains__ + return (orig(filename) or + orig(lfutil.standin(filename))) + man1.__class__ = lfilesmanifest return man1 def filectx(self, path, fileid=None, filelog=None): orig = super(lfilesctx, self).filectx