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.
--- 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