changeset 46990:0b569c75d180

store: exclude `undo.` nodemap's file from `walk` There are "temporary" local file that we should not be transfered by `walk` user like local clone and stream clone. This fix the small issue that the new tests highlighted. Differential Revision: https://phab.mercurial-scm.org/D10482
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 20 Apr 2021 04:27:03 +0200
parents aed6ceaad6d7
children 83c0d144ef8d
files mercurial/store.py tests/test-persistent-nodemap.t
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/store.py	Tue Apr 20 05:08:55 2021 +0200
+++ b/mercurial/store.py	Tue Apr 20 04:27:03 2021 +0200
@@ -10,6 +10,7 @@
 import errno
 import functools
 import os
+import re
 import stat
 
 from .i18n import _
@@ -395,6 +396,9 @@
 # deleted.
 REVLOG_FILES_VOLATILE_EXT = (b'.n', b'.nd')
 
+# some exception to the above matching
+EXCLUDED = re.compile(b'.*undo\.[^/]+\.nd?$')
+
 
 def is_revlog(f, kind, st):
     if kind != stat.S_IFREG:
@@ -405,7 +409,7 @@
 def revlog_type(f):
     if f.endswith(REVLOG_FILES_MAIN_EXT):
         return FILEFLAGS_REVLOG_MAIN
-    elif f.endswith(REVLOG_FILES_OTHER_EXT):
+    elif f.endswith(REVLOG_FILES_OTHER_EXT) and EXCLUDED.match(f) is None:
         t = FILETYPE_FILELOG_OTHER
         if f.endswith(REVLOG_FILES_VOLATILE_EXT):
             t |= FILEFLAGS_VOLATILE
--- a/tests/test-persistent-nodemap.t	Tue Apr 20 05:08:55 2021 +0200
+++ b/tests/test-persistent-nodemap.t	Tue Apr 20 04:27:03 2021 +0200
@@ -988,8 +988,6 @@
   $ touch $HG_TEST_STREAM_WALKED_FILE_2
   $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3
   $ cat clone-output-2
-  adding [s] undo.backup.00manifest.n (70 bytes) (known-bad-output !)
-  adding [s] undo.backup.00changelog.n (70 bytes) (known-bad-output !)
   adding [s] 00manifest.n (70 bytes)
   adding [s] 00manifest-*.nd (118 KB) (glob)
   adding [s] 00changelog.n (70 bytes)