253 if len(res) > _maxstorepathlen: |
253 if len(res) > _maxstorepathlen: |
254 res = _hashencode(path, dotencode) |
254 res = _hashencode(path, dotencode) |
255 return res |
255 return res |
256 |
256 |
257 def _pathencode(path): |
257 def _pathencode(path): |
|
258 de = encodedir(path) |
258 if len(path) > _maxstorepathlen: |
259 if len(path) > _maxstorepathlen: |
259 return None |
260 return _hashencode(de, True) |
260 ef = _encodefname(encodedir(path)).split('/') |
261 ef = _encodefname(de).split('/') |
261 res = '/'.join(_auxencode(ef, True)) |
262 res = '/'.join(_auxencode(ef, True)) |
262 if len(res) > _maxstorepathlen: |
263 if len(res) > _maxstorepathlen: |
263 return None |
264 return _hashencode(de, True) |
264 return res |
265 return res |
265 |
266 |
266 _pathencode = getattr(parsers, 'pathencode', _pathencode) |
267 _pathencode = getattr(parsers, 'pathencode', _pathencode) |
267 |
|
268 def _dothybridencode(f): |
|
269 ef = _pathencode(f) |
|
270 if ef is None: |
|
271 return _hashencode(encodedir(f), True) |
|
272 return ef |
|
273 |
268 |
274 def _plainhybridencode(f): |
269 def _plainhybridencode(f): |
275 return _hybridencode(f, False) |
270 return _hybridencode(f, False) |
276 |
271 |
277 def _calcmode(vfs): |
272 def _calcmode(vfs): |
454 return self.vfs.join(path) |
449 return self.vfs.join(path) |
455 |
450 |
456 class fncachestore(basicstore): |
451 class fncachestore(basicstore): |
457 def __init__(self, path, vfstype, dotencode): |
452 def __init__(self, path, vfstype, dotencode): |
458 if dotencode: |
453 if dotencode: |
459 encode = _dothybridencode |
454 encode = _pathencode |
460 else: |
455 else: |
461 encode = _plainhybridencode |
456 encode = _plainhybridencode |
462 self.encode = encode |
457 self.encode = encode |
463 vfs = vfstype(path + '/store') |
458 vfs = vfstype(path + '/store') |
464 self.path = vfs.base |
459 self.path = vfs.base |