Show More
@@ -365,26 +365,27 b' class fncache(object):' | |||||
365 | self._load() |
|
365 | self._load() | |
366 | return iter(self.entries) |
|
366 | return iter(self.entries) | |
367 |
|
367 | |||
|
368 | class _fncacheopener(scmutil.abstractopener): | |||
|
369 | def __init__(self, op, fnc, encode): | |||
|
370 | self.opener = op | |||
|
371 | self.fncache = fnc | |||
|
372 | self.encode = encode | |||
|
373 | ||||
|
374 | def __call__(self, path, mode='r', *args, **kw): | |||
|
375 | if mode not in ('r', 'rb') and path.startswith('data/'): | |||
|
376 | self.fncache.add(path) | |||
|
377 | return self.opener(self.encode(path), mode, *args, **kw) | |||
|
378 | ||||
368 | class fncachestore(basicstore): |
|
379 | class fncachestore(basicstore): | |
369 | def __init__(self, path, openertype, encode): |
|
380 | def __init__(self, path, openertype, encode): | |
370 | self.encode = encode |
|
381 | self.encode = encode | |
371 | self.path = path + '/store' |
|
382 | self.path = path + '/store' | |
372 | self.createmode = _calcmode(self.path) |
|
383 | self.createmode = _calcmode(self.path) | |
373 |
|
384 | op = openertype(self.path) | ||
374 | storeself = self |
|
|||
375 |
|
||||
376 | class fncacheopener(openertype): |
|
|||
377 | def __call__(self, path, mode='r', *args, **kw): |
|
|||
378 | if mode not in ('r', 'rb') and path.startswith('data/'): |
|
|||
379 | fnc.add(path) |
|
|||
380 | return openertype.__call__(self, storeself.encode(path), mode, |
|
|||
381 | *args, **kw) |
|
|||
382 |
|
||||
383 | op = fncacheopener(self.path) |
|
|||
384 | op.createmode = self.createmode |
|
385 | op.createmode = self.createmode | |
385 | fnc = fncache(op) |
|
386 | fnc = fncache(op) | |
386 | self.fncache = fnc |
|
387 | self.fncache = fnc | |
387 | self.opener = op |
|
388 | self.opener = _fncacheopener(op, fnc, encode) | |
388 |
|
389 | |||
389 | def join(self, f): |
|
390 | def join(self, f): | |
390 | return self.path + '/' + self.encode(f) |
|
391 | return self.path + '/' + self.encode(f) |
General Comments 0
You need to be logged in to leave comments.
Login now