# HG changeset patch # User Pierre-Yves David # Date 1552657976 0 # Node ID 1fe278aa4ad5a8a327781096a80e1003514eeca0 # Parent 131d0b7c3940b035f609a698f21a92e8218ec2ac manifestcache: support multiple cache addition in one debug command run This is more practical. diff -r 131d0b7c3940 -r 1fe278aa4ad5 mercurial/debugcommands.py --- 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() diff -r 131d0b7c3940 -r 1fe278aa4ad5 tests/test-manifest.t --- a/tests/test-manifest.t Thu Mar 14 18:11:22 2019 -0700 +++ b/tests/test-manifest.t Fri Mar 15 13:52:56 2019 +0000 @@ -148,3 +148,13 @@ $ hg debugmanifestfulltextcache --clear $ hg debugmanifestfulltextcache cache empty + +Check adding multiple entry in one go: + + $ hg debugmanifestfulltextcache --add fce2a30dedad1eef4da95ca1dc0004157aa527cf --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7 + $ hg debugmanifestfulltextcache + cache contains 2 manifest entries, in order of most to least recent: + id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes + id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes + total cache data size 268 bytes, on-disk 268 bytes + $ hg debugmanifestfulltextcache --clear