[PATCH 2 of 2 v2] verify: print hint to run debugrebuildfncache

Gregory Szorc gregory.szorc at gmail.com
Mon Jun 22 12:04:55 CDT 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1434856313 25200
#      Sat Jun 20 20:11:53 2015 -0700
# Node ID 431679b09139e44952a0be0fa1480aa38c45c10f
# Parent  8f10b76a327e7ac8c4f6b2691c31cedd7e8fa5e6
verify: print hint to run debugrebuildfncache

Corrupt fncache is now a recoverable operation. Inform the user how to
recover from this warning.

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -218,8 +218,9 @@ def _verify(repo):
             err(None, _("cannot decode filename '%s'") % f2)
         elif size > 0 or not revlogv1:
             storefiles.add(_normpath(f))
 
+    fncachewarned = False
     files = sorted(set(filenodes) | set(filelinkrevs))
     total = len(files)
     for i, f in enumerate(files):
         ui.progress(_('checking'), i, item=f, total=total)
@@ -244,8 +245,9 @@ def _verify(repo):
             try:
                 storefiles.remove(ff)
             except KeyError:
                 warn(_(" warning: revlog '%s' not in fncache!") % ff)
+                fncachewarned = True
 
         checklog(fl, f, lr)
         seen = {}
         rp = None
@@ -312,8 +314,11 @@ def _verify(repo):
     ui.status(_("%d files, %d changesets, %d total revisions\n") %
                    (len(files), len(cl), revisions))
     if warnings[0]:
         ui.warn(_("%d warnings encountered!\n") % warnings[0])
+    if fncachewarned:
+        ui.warn(_('hint: run "hg debugrebuildfncache" to recover from '
+                  'corrupt fncache\n'))
     if errors[0]:
         ui.warn(_("%d integrity errors encountered!\n") % errors[0])
         if badrevs:
             ui.warn(_("(first damaged changeset appears to be %d)\n")
diff --git a/tests/test-fncache.t b/tests/test-fncache.t
--- a/tests/test-fncache.t
+++ b/tests/test-fncache.t
@@ -52,8 +52,25 @@ Testing verify:
    warning: revlog 'data/a.i.hg/c.i' not in fncache!
    warning: revlog 'data/a.i/b.i' not in fncache!
   3 files, 3 changesets, 3 total revisions
   3 warnings encountered!
+  hint: run "hg debugrebuildfncache" to recover from corrupt fncache
+
+Follow the hint to make sure it works
+
+  $ hg debugrebuildfncache
+  adding data/a.i
+  adding data/a.i.hg/c.i
+  adding data/a.i/b.i
+  3 items added, 0 removed from fncache
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  3 files, 3 changesets, 3 total revisions
+
   $ cd ..
 
 Non store repo:
 
diff --git a/tests/test-verify.t b/tests/test-verify.t
--- a/tests/test-verify.t
+++ b/tests/test-verify.t
@@ -54,8 +54,9 @@ introduce some bugs in repo
    0: empty or missing bar.txt
    bar.txt at 0: 256559129457 in manifests not found
   3 files, 1 changesets, 0 total revisions
   3 warnings encountered!
+  hint: run "hg debugrebuildfncache" to recover from corrupt fncache
   6 integrity errors encountered!
   (first damaged changeset appears to be 0)
   [1]
 


More information about the Mercurial-devel mailing list