comparison hgext/largefiles/reposetup.py @ 24287:f78252429e0a

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.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 11 Mar 2015 21:36:48 -0700
parents 2720f967a7b1
children 586d33f47dca
comparison
equal deleted inserted replaced
24286:40528ad1b1e8 24287:f78252429e0a
42 def files(self): 42 def files(self):
43 filenames = super(lfilesctx, self).files() 43 filenames = super(lfilesctx, self).files()
44 return [lfutil.splitstandin(f) or f for f in filenames] 44 return [lfutil.splitstandin(f) or f for f in filenames]
45 def manifest(self): 45 def manifest(self):
46 man1 = super(lfilesctx, self).manifest() 46 man1 = super(lfilesctx, self).manifest()
47 orig = man1.__contains__ 47 class lfilesmanifest(man1.__class):
48 def __contains__(self, filename): 48 def __contains__(self, filename):
49 return (orig(filename) or 49 orig = super(lfilesmanifest, self).__contains__
50 orig(lfutil.standin(filename))) 50 return (orig(filename) or
51 man1.__contains__ = __contains__.__get__(man1) 51 orig(lfutil.standin(filename)))
52 man1.__class__ = lfilesmanifest
52 return man1 53 return man1
53 def filectx(self, path, fileid=None, filelog=None): 54 def filectx(self, path, fileid=None, filelog=None):
54 orig = super(lfilesctx, self).filectx 55 orig = super(lfilesctx, self).filectx
55 try: 56 try:
56 if filelog is not None: 57 if filelog is not None: