diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
index a72caf0af38e06c231c2b00ac89fc7e0d50f9768_bWVyY3VyaWFsL2RlYnVnY29tbWFuZHMucHk=..ccef71de7d41295c657d783e9caa7567d36fa529_bWVyY3VyaWFsL2RlYnVnY29tbWFuZHMucHk= 100644
--- 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
index a72caf0af38e06c231c2b00ac89fc7e0d50f9768_dGVzdHMvdGVzdC1jb21wbGV0aW9uLnQ=..ccef71de7d41295c657d783e9caa7567d36fa529_dGVzdHMvdGVzdC1jb21wbGV0aW9uLnQ= 100644
--- 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
index a72caf0af38e06c231c2b00ac89fc7e0d50f9768_dGVzdHMvdGVzdC1kZWJ1Z2NvbW1hbmRzLnQ=..ccef71de7d41295c657d783e9caa7567d36fa529_dGVzdHMvdGVzdC1kZWJ1Z2NvbW1hbmRzLnQ= 100644
--- 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
index a72caf0af38e06c231c2b00ac89fc7e0d50f9768_dGVzdHMvdGVzdC1oZWxwLnQ=..ccef71de7d41295c657d783e9caa7567d36fa529_dGVzdHMvdGVzdC1oZWxwLnQ= 100644
--- 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