localrepo: warn if we are writing to cache without a lock
authorPulkit Goyal <7895pulkit@gmail.com>
Tue, 08 Sep 2020 18:46:01 +0530
changeset 45433 324ad3e7ef41
parent 45432 f52b0297acc8
child 45434 5523e3e1bc71
localrepo: warn if we are writing to cache without a lock From quite sometime we have two types of cache, `cache` and `wcache`. The later one is a working copy cache and the first one is a store cache. Let's add a check for warning if we are missing store lock while writing to these caches. This is inspired from some tag cache breakage which is observed when multiple shares are in play. The interesting part is that although we are still taking wlock to write store caches at many places, but still the test pases. Differential Revision: https://phab.mercurial-scm.org/D9000
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Sep 03 14:14:40 2020 +0530
+++ b/mercurial/localrepo.py	Tue Sep 08 18:46:01 2020 +0530
@@ -1250,7 +1250,12 @@
                 msg = b'accessing cache with vfs instead of cachevfs: "%s"'
                 repo.ui.develwarn(msg % path, stacklevel=3, config=b"cache-vfs")
             # path prefixes covered by 'lock'
-            vfs_path_prefixes = (b'journal.', b'undo.', b'strip-backup/')
+            vfs_path_prefixes = (
+                b'journal.',
+                b'undo.',
+                b'strip-backup/',
+                b'cache/',
+            )
             if any(path.startswith(prefix) for prefix in vfs_path_prefixes):
                 if repo._currentlock(repo._lockref) is None:
                     repo.ui.develwarn(