equal
deleted
inserted
replaced
7 |
7 |
8 from __future__ import absolute_import |
8 from __future__ import absolute_import |
9 |
9 |
10 import errno |
10 import errno |
11 import functools |
11 import functools |
12 import hashlib |
|
13 import os |
12 import os |
14 import stat |
13 import stat |
15 |
14 |
16 from .i18n import _ |
15 from .i18n import _ |
17 from .pycompat import getattr |
16 from .pycompat import getattr |
23 policy, |
22 policy, |
24 pycompat, |
23 pycompat, |
25 util, |
24 util, |
26 vfs as vfsmod, |
25 vfs as vfsmod, |
27 ) |
26 ) |
|
27 from .utils import hashutil |
28 |
28 |
29 parsers = policy.importmod('parsers') |
29 parsers = policy.importmod('parsers') |
30 # how much bytes should be read from fncache in one read |
30 # how much bytes should be read from fncache in one read |
31 # It is done to prevent loading large fncache files into memory |
31 # It is done to prevent loading large fncache files into memory |
32 fncache_chunksize = 10 ** 6 |
32 fncache_chunksize = 10 ** 6 |
271 _dirprefixlen = 8 |
271 _dirprefixlen = 8 |
272 _maxshortdirslen = 8 * (_dirprefixlen + 1) - 4 |
272 _maxshortdirslen = 8 * (_dirprefixlen + 1) - 4 |
273 |
273 |
274 |
274 |
275 def _hashencode(path, dotencode): |
275 def _hashencode(path, dotencode): |
276 digest = node.hex(hashlib.sha1(path).digest()) |
276 digest = node.hex(hashutil.sha1(path).digest()) |
277 le = lowerencode(path[5:]).split(b'/') # skips prefix 'data/' or 'meta/' |
277 le = lowerencode(path[5:]).split(b'/') # skips prefix 'data/' or 'meta/' |
278 parts = _auxencode(le, dotencode) |
278 parts = _auxencode(le, dotencode) |
279 basename = parts[-1] |
279 basename = parts[-1] |
280 _root, ext = os.path.splitext(basename) |
280 _root, ext = os.path.splitext(basename) |
281 sdirs = [] |
281 sdirs = [] |