diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1476,13 +1476,13 @@ def debugmanifestfulltextcache(ui, repo, raise error.Abort(msg) if opts.get(r'clear'): - with repo.lock(): + with repo.wlock(): cache = getcache() cache.clear(clear_persisted_data=True) return if add: - with repo.lock(): + with repo.wlock(): m = repo.manifestlog store = m.getstorage(b'') for n in add: diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1435,11 +1435,11 @@ class manifestrevlog(object): def _setupmanifestcachehooks(self, repo): """Persist the manifestfulltextcache on lock release""" - if not util.safehasattr(repo, '_lockref'): + if not util.safehasattr(repo, '_wlockref'): return self._fulltextcache._opener = repo.cachevfs - if repo._currentlock(repo._lockref) is None: + if repo._currentlock(repo._wlockref) is None: return reporef = weakref.ref(repo) diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -58,6 +58,7 @@ Ensure branchcache got copied over: $ ls .hg/cache branch2-served + manifestfulltextcache rbc-names-v1 rbc-revs-v1 diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks.t @@ -290,7 +290,7 @@ Update back to revision 12 in r4 should 1 r4/.hg/branch 2 r4/.hg/cache/branch2-base 2 r4/.hg/cache/branch2-served - 2 r4/.hg/cache/manifestfulltextcache (reporevlogstore !) + 1 r4/.hg/cache/manifestfulltextcache (reporevlogstore !) 2 r4/.hg/cache/rbc-names-v1 2 r4/.hg/cache/rbc-revs-v1 1 r4/.hg/dirstate diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -106,7 +106,9 @@ Reminder of the manifest log content Showing the content of the caches after the above operations $ hg debugmanifestfulltextcache - cache empty + cache contains 1 manifest entries, in order of most to least recent: + id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes + total cache data size 157 bytes, on-disk 157 bytes (Clearing the cache in case of any content) @@ -183,3 +185,19 @@ Commit should have the new node cached: $ hg log -r 'ancestors(., 1)' --debug | grep 'manifest:' manifest: 1:1e01206b1d2f72bd55f2a33fa8ccad74144825b7 manifest: 2:26b8653b67af8c1a0a0317c4ee8dac50a41fdb65 + +hg update should warm the cache too + +(force dirstate check to avoid flackiness in manifest order) + $ hg debugrebuilddirstate + + $ hg update 0 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg debugmanifestfulltextcache + cache contains 3 manifest entries, in order of most to least recent: + id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes + id: 26b8653b67af8c1a0a0317c4ee8dac50a41fdb65, size 133 bytes + id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes + total cache data size 425 bytes, on-disk 425 bytes + $ hg log -r '0' --debug | grep 'manifest:' + manifest: 0:fce2a30dedad1eef4da95ca1dc0004157aa527cf