Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 45433:324ad3e7ef41
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
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 08 Sep 2020 18:46:01 +0530 |
parents | 4111954cf86d |
children | 4a0ccbecbaa6 |
comparison
equal
deleted
inserted
replaced
45432:f52b0297acc8 | 45433:324ad3e7ef41 |
---|---|
1248 path = path[len(repo.path) + 1 :] | 1248 path = path[len(repo.path) + 1 :] |
1249 if path.startswith(b'cache/'): | 1249 if path.startswith(b'cache/'): |
1250 msg = b'accessing cache with vfs instead of cachevfs: "%s"' | 1250 msg = b'accessing cache with vfs instead of cachevfs: "%s"' |
1251 repo.ui.develwarn(msg % path, stacklevel=3, config=b"cache-vfs") | 1251 repo.ui.develwarn(msg % path, stacklevel=3, config=b"cache-vfs") |
1252 # path prefixes covered by 'lock' | 1252 # path prefixes covered by 'lock' |
1253 vfs_path_prefixes = (b'journal.', b'undo.', b'strip-backup/') | 1253 vfs_path_prefixes = ( |
1254 b'journal.', | |
1255 b'undo.', | |
1256 b'strip-backup/', | |
1257 b'cache/', | |
1258 ) | |
1254 if any(path.startswith(prefix) for prefix in vfs_path_prefixes): | 1259 if any(path.startswith(prefix) for prefix in vfs_path_prefixes): |
1255 if repo._currentlock(repo._lockref) is None: | 1260 if repo._currentlock(repo._lockref) is None: |
1256 repo.ui.develwarn( | 1261 repo.ui.develwarn( |
1257 b'write with no lock: "%s"' % path, | 1262 b'write with no lock: "%s"' % path, |
1258 stacklevel=3, | 1263 stacklevel=3, |