Patchwork [8,of,8,"] manifestcache: actually honor --clear

login
register
mail settings
Submitter Pierre-Yves David
Date March 15, 2019, 11:43 a.m.
Message ID <8af71b30c498ab0cdd3f.1552650210@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39264/
State Accepted
Headers show

Comments

Pierre-Yves David - March 15, 2019, 11:43 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1552554766 0
#      Thu Mar 14 09:12:46 2019 +0000
# Node ID 8af71b30c498ab0cdd3f5553e9a9dba2de68861d
# Parent  01b0e1930dd902040648343e0908ee6be75552d3
# EXP-Topic manifestcache
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 8af71b30c498
manifestcache: actually honor --clear

Before this change, the --clear flag was not clearing the on disk cache.
(We also remove the extra verbosity when using --clear. Same as what we did for --add)

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1478,7 +1478,8 @@  def debugmanifestfulltextcache(ui, repo,
     if opts.get(r'clear'):
         with repo.lock():
             cache = getcache()
-            cache.clear()
+            cache.clear(clear_persisted_data=True)
+            return
 
     if add:
         with repo.lock():
diff --git a/tests/test-manifest.t b/tests/test-manifest.t
--- a/tests/test-manifest.t
+++ b/tests/test-manifest.t
@@ -142,3 +142,9 @@  Accessing the initial entry again, refre
   id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes
   id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes
   total cache data size 268 bytes, on-disk 268 bytes
+
+Check cache clearing
+
+  $ hg debugmanifestfulltextcache --clear
+  $ hg debugmanifestfulltextcache
+  cache empty