comparison mercurial/store.py @ 17845:408ded42c5ec stable

scmutil: abstract out mustaudit delegation
author Bryan O'Sullivan <bryano@fb.com>
date Mon, 22 Oct 2012 11:59:11 -0700
parents 73e1ab39792c
children b35e3364f94a
comparison
equal deleted inserted replaced
17844:b32e55e6c3c7 17845:408ded42c5ec
434 def __iter__(self): 434 def __iter__(self):
435 if self.entries is None: 435 if self.entries is None:
436 self._load() 436 self._load()
437 return iter(self.entries) 437 return iter(self.entries)
438 438
439 class _fncachevfs(scmutil.abstractvfs): 439 class _fncachevfs(scmutil.abstractvfs, scmutil.auditvfs):
440 def __init__(self, vfs, fnc, encode): 440 def __init__(self, vfs, fnc, encode):
441 self.vfs = vfs 441 scmutil.auditvfs.__init__(self, vfs)
442 self.fncache = fnc 442 self.fncache = fnc
443 self.encode = encode 443 self.encode = encode
444
445 def _getmustaudit(self):
446 return self.vfs.mustaudit
447
448 def _setmustaudit(self, onoff):
449 self.vfs.mustaudit = onoff
450
451 mustaudit = property(_getmustaudit, _setmustaudit)
452 444
453 def __call__(self, path, mode='r', *args, **kw): 445 def __call__(self, path, mode='r', *args, **kw):
454 if mode not in ('r', 'rb') and path.startswith('data/'): 446 if mode not in ('r', 'rb') and path.startswith('data/'):
455 self.fncache.add(path) 447 self.fncache.add(path)
456 return self.vfs(self.encode(path), mode, *args, **kw) 448 return self.vfs(self.encode(path), mode, *args, **kw)