equal
deleted
inserted
replaced
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 os |
12 import os |
|
13 import re |
13 import stat |
14 import stat |
14 |
15 |
15 from .i18n import _ |
16 from .i18n import _ |
16 from .pycompat import getattr |
17 from .pycompat import getattr |
17 from .node import hex |
18 from .node import hex |
393 # |
394 # |
394 # note: the ".nd" file are nodemap data and won't "change" but they might be |
395 # note: the ".nd" file are nodemap data and won't "change" but they might be |
395 # deleted. |
396 # deleted. |
396 REVLOG_FILES_VOLATILE_EXT = (b'.n', b'.nd') |
397 REVLOG_FILES_VOLATILE_EXT = (b'.n', b'.nd') |
397 |
398 |
|
399 # some exception to the above matching |
|
400 EXCLUDED = re.compile(b'.*undo\.[^/]+\.nd?$') |
|
401 |
398 |
402 |
399 def is_revlog(f, kind, st): |
403 def is_revlog(f, kind, st): |
400 if kind != stat.S_IFREG: |
404 if kind != stat.S_IFREG: |
401 return None |
405 return None |
402 return revlog_type(f) |
406 return revlog_type(f) |
403 |
407 |
404 |
408 |
405 def revlog_type(f): |
409 def revlog_type(f): |
406 if f.endswith(REVLOG_FILES_MAIN_EXT): |
410 if f.endswith(REVLOG_FILES_MAIN_EXT): |
407 return FILEFLAGS_REVLOG_MAIN |
411 return FILEFLAGS_REVLOG_MAIN |
408 elif f.endswith(REVLOG_FILES_OTHER_EXT): |
412 elif f.endswith(REVLOG_FILES_OTHER_EXT) and EXCLUDED.match(f) is None: |
409 t = FILETYPE_FILELOG_OTHER |
413 t = FILETYPE_FILELOG_OTHER |
410 if f.endswith(REVLOG_FILES_VOLATILE_EXT): |
414 if f.endswith(REVLOG_FILES_VOLATILE_EXT): |
411 t |= FILEFLAGS_VOLATILE |
415 t |= FILEFLAGS_VOLATILE |
412 return t |
416 return t |
413 |
417 |