diff mercurial/debugcommands.py @ 41963:1fe278aa4ad5

manifestcache: support multiple cache addition in one debug command run This is more practical.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 15 Mar 2019 13:52:56 +0000
parents b74ef67573e5
children e3307243d188
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Thu Mar 14 18:11:22 2019 -0700
+++ b/mercurial/debugcommands.py	Fri Mar 15 13:52:56 2019 +0000
@@ -1460,10 +1460,10 @@
 
 @command('debugmanifestfulltextcache', [
         ('', 'clear', False, _('clear the cache')),
-        ('a', 'add', '', _('add the given manifest node to the cache'),
+        ('a', 'add', [], _('add the given manifest nodes to the cache'),
          _('NODE'))
     ], '')
-def debugmanifestfulltextcache(ui, repo, add=None, **opts):
+def debugmanifestfulltextcache(ui, repo, add=(), **opts):
     """show, clear or amend the contents of the manifest fulltext cache"""
 
     def getcache():
@@ -1483,12 +1483,14 @@
 
     if add:
         with repo.lock():
-            try:
-                m = repo.manifestlog
-                manifest = m[m.getstorage(b'').lookup(add)]
-            except error.LookupError as e:
-                raise error.Abort(e, hint="Check your manifest node id")
-            manifest.read()  # stores revisision in cache too
+            m = repo.manifestlog
+            store = m.getstorage(b'')
+            for n in add:
+                try:
+                    manifest = m[store.lookup(n)]
+                except error.LookupError as e:
+                    raise error.Abort(e, hint="Check your manifest node id")
+                manifest.read()  # stores revisision in cache too
             return
 
     cache = getcache()