[PATCH 1 of 8 "] manifestcache: support multiple cache addition in one debug command run
Pulkit Goyal
7895pulkit at gmail.com
Sat Mar 16 18:59:05 EDT 2019
On Sat, Mar 16, 2019 at 1:46 PM Pierre-Yves David <
pierre-yves.david at ens-lyon.org> wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at octobus.net>
> # Date 1552657976 0
> # Fri Mar 15 13:52:56 2019 +0000
> # Node ID 85fa9d19ba227cb04a6c4209a71b1a2f858c6ede
> # Parent b74ef67573e58294771487c5e39f003a9512d11a
> # EXP-Topic manifestcache
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 85fa9d19ba22
> manifestcache: support multiple cache addition in one debug command run
>
> This is more practical.
>
Queued the series, many thanks!
>
> diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
> --- a/mercurial/debugcommands.py
> +++ b/mercurial/debugcommands.py
> @@ -1460,10 +1460,10 @@ def debuglocks(ui, repo, **opts):
>
> @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 @@ def debugmanifestfulltextcache(ui, repo,
>
> 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")
>
Since the command can accept multiple nodeids now, it will be nice to
mention the node id in error output.
> + manifest.read() # stores revisision in cache too
> return
>
> cache = getcache()
> diff --git a/tests/test-manifest.t b/tests/test-manifest.t
> --- a/tests/test-manifest.t
> +++ b/tests/test-manifest.t
> @@ -148,3 +148,13 @@ Check cache clearing
> $ 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20190317/41592595/attachment.html>
More information about the Mercurial-devel
mailing list