# HG changeset patch # User Pierre-Yves David <pierre-yves.david@ens-lyon.org> # Date 1493753706 -7200 # Tue May 02 21:35:06 2017 +0200 # Node ID ccef71de7d41295c657d783e9caa7567d36fa529 # Parent a72caf0af38e06c231c2b00ac89fc7e0d50f9768 caches: introduce a 'debugupdatecaches' command That command make sure caches are updated. This is based on 'localrepo.updatecaches' so when we move support for new cache in that function this command will benefit from it. diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2130,6 +2130,13 @@ displayer.show(repo[r], **props) displayer.close() +@command('debugupdatecaches', []) +def debugupdatecaches(ui, repo, *pats, **opts): + """warm all known caches in the repository""" + with repo.wlock(): + with repo.lock(): + repo.updatecaches() + @command('debugupgraderepo', [ ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')), ('', 'run', False, _('performs an upgrade')), diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -111,6 +111,7 @@ debugsub debugsuccessorssets debugtemplate + debugupdatecaches debugupgraderepo debugwalk debugwireargs @@ -285,6 +286,7 @@ debugsub: rev debugsuccessorssets: debugtemplate: rev, define + debugupdatecaches: debugupgraderepo: optimize, run debugwalk: include, exclude debugwireargs: three, four, five, ssh, remotecmd, insecure diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -109,6 +109,16 @@ 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob) 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob) 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob) + +Test cache warming command + + $ rm -rf .hg/cache/ + $ hg debugupdatecaches --debug + $ ls -r .hg/cache/* + .hg/cache/rbc-revs-v1 + .hg/cache/rbc-names-v1 + .hg/cache/branch2-served + $ cd .. Test internal debugstacktrace command diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -931,6 +931,8 @@ show set of successors for revision debugtemplate parse and apply a template + debugupdatecaches + warm all known caches in the repository debugupgraderepo upgrade a repository to use different features debugwalk show how files match on given patterns