Patchwork [1,of,2] localrepo: warn if we are writing to cache without a lock

mail settings
Submitter Pulkit Goyal
Date Sept. 10, 2020, 6:13 a.m.
Message ID <5ecbecdc0aa49eb6a387.1599718427@workspace>
Download mbox | patch
Permalink /patch/47117/
State Superseded
Headers show


Pulkit Goyal - Sept. 10, 2020, 6:13 a.m.
# HG changeset patch
# User Pulkit Goyal <>
# Date 1599570961 -19800
#      Tue Sep 08 18:46:01 2020 +0530
# Node ID 5ecbecdc0aa49eb6a3878e01f8aa99417602b957
# Parent  0babbc33baec093b9119be36ec535edb8a12b3b8
# EXP-Topic tags-fix
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:


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -1250,7 +1250,12 @@  class localrepository(object):
                 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: