diff mercurial/debugcommands.py @ 47875:0fb328bb2459

debugrebuildfncache: add a cheaper option to rebuild the fncache On my repository, debugrebuildfncache takes 5-10min with the lock. With the flag added in this commit, it takes 10s. The tradeoff is that it only recovers from certain kinds of corruptions. It is intended to to recover faster from fncaches broken by a revlog split during a transaction that ends up being rolled back. Differential Revision: https://phab.mercurial-scm.org/D11265
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Fri, 06 Aug 2021 16:27:17 -0400
parents 855463b5fe49
children 357307feaf61
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Fri Aug 06 16:17:17 2021 -0400
+++ b/mercurial/debugcommands.py	Fri Aug 06 16:27:17 2021 -0400
@@ -2987,10 +2987,22 @@
         dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
 
 
-@command(b'debugrebuildfncache', [], b'')
-def debugrebuildfncache(ui, repo):
+@command(
+    b'debugrebuildfncache',
+    [
+        (
+            b'',
+            b'only-data',
+            False,
+            _(b'only look for wrong .d files (much faster)'),
+        )
+    ],
+    b'',
+)
+def debugrebuildfncache(ui, repo, **opts):
     """rebuild the fncache file"""
-    repair.rebuildfncache(ui, repo)
+    opts = pycompat.byteskwargs(opts)
+    repair.rebuildfncache(ui, repo, opts.get(b"only_data"))
 
 
 @command(