Mercurial > hg
comparison mercurial/store.py @ 17623:448e6ed7c557
store: move _plainhybridencode and _dothybridencode higher up in the file
no functional change
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Wed, 19 Sep 2012 13:58:51 +0200 |
parents | 1a42f19ad958 |
children | ae103510f6aa |
comparison
equal
deleted
inserted
replaced
17622:57bf86677daa | 17623:448e6ed7c557 |
---|---|
252 res = '/'.join(_auxencode(ef, dotencode)) | 252 res = '/'.join(_auxencode(ef, dotencode)) |
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 _plainhybridencode(f): | |
258 return _hybridencode(f, False) | |
259 | |
260 _pathencode = getattr(parsers, 'pathencode', None) | |
261 if _pathencode: | |
262 def _dothybridencode(f): | |
263 ef = _pathencode(f) | |
264 if ef is None: | |
265 return _hashencode(encodedir(f), True) | |
266 return ef | |
267 else: | |
268 def _dothybridencode(f): | |
269 return _hybridencode(f, True) | |
270 | |
257 def _calcmode(path): | 271 def _calcmode(path): |
258 try: | 272 try: |
259 # files in .hg/ will be created using this mode | 273 # files in .hg/ will be created using this mode |
260 mode = os.stat(path).st_mode | 274 mode = os.stat(path).st_mode |
261 # avoid some useless chmods | 275 # avoid some useless chmods |
417 def __call__(self, path, mode='r', *args, **kw): | 431 def __call__(self, path, mode='r', *args, **kw): |
418 if mode not in ('r', 'rb') and path.startswith('data/'): | 432 if mode not in ('r', 'rb') and path.startswith('data/'): |
419 self.fncache.add(path) | 433 self.fncache.add(path) |
420 return self.opener(self.encode(path), mode, *args, **kw) | 434 return self.opener(self.encode(path), mode, *args, **kw) |
421 | 435 |
422 def _plainhybridencode(f): | |
423 return _hybridencode(f, False) | |
424 | |
425 _pathencode = getattr(parsers, 'pathencode', None) | |
426 if _pathencode: | |
427 def _dothybridencode(f): | |
428 ef = _pathencode(f) | |
429 if ef is None: | |
430 return _hashencode(encodedir(f), True) | |
431 return ef | |
432 else: | |
433 def _dothybridencode(f): | |
434 return _hybridencode(f, True) | |
435 | |
436 class fncachestore(basicstore): | 436 class fncachestore(basicstore): |
437 def __init__(self, path, openertype, dotencode): | 437 def __init__(self, path, openertype, dotencode): |
438 if dotencode: | 438 if dotencode: |
439 encode = _dothybridencode | 439 encode = _dothybridencode |
440 else: | 440 else: |