[PATCH 2 of 2] verify: look for missing revlogs

Mads Kiilerich mads at kiilerich.com
Sat Apr 21 10:55:48 CDT 2012


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1335023201 -7200
# Branch stable
# Node ID 267c1dfd77ecd34efc3ab3bdef06e43a9fa9fca0
# Parent  e966c636e5412cb5e99ffcd7fa41cd8618ed6d7c
verify: look for missing revlogs

Verify removed missing revlogs from fncache while checking and warning "missing
revlog!". That made the revlogs even more missing and it made recovery harder.

Verify could be considered a read-only operation and it might thus not be
appreciated that it modify the repo it is testing in any way. The fncache name
do however imply that it is a cache and it could thus be considered ok that it
updates the cache ... if only there were some means to populate the cache with
missing entries. fncache is apparently more like a index or a map than a cache.

This change allow verify to recover the fncache entries it (or other commands)
has removed.

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -229,7 +229,12 @@
             try:
                 storefiles.remove(ff)
             except KeyError:
-                err(lr, _("missing revlog!"), ff)
+                try:
+                    repo.store.opener(ff)
+                    warn(" %s: found missing revlog" % ff)
+                    repo.store.fncache.add(ff)
+                except IOError, e:
+                    err(lr, _("missing revlog!"), ff)
 
         checklog(fl, f, lr)
         seen = {}
diff --git a/tests/test-fncache.t b/tests/test-fncache.t
--- a/tests/test-fncache.t
+++ b/tests/test-fncache.t
@@ -48,13 +48,11 @@
   checking manifests
   crosschecking files in changesets and manifests
   checking files
-   data/a.i at 0: missing revlog!
-   data/a.i.hg/c.i at 2: missing revlog!
-   data/a.i/b.i at 1: missing revlog!
+   data/a.i: found missing revlog
+   data/a.i.hg/c.i: found missing revlog
+   data/a.i/b.i: found missing revlog
   3 files, 3 changesets, 3 total revisions
-  3 integrity errors encountered!
-  (first damaged changeset appears to be 0)
-  [1]
+  3 warnings encountered!
   $ 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
@@ -79,14 +79,28 @@
   checking manifests
   crosschecking files in changesets and manifests
   checking files
-   data/1234567.9/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.i at 0: missing revlog!
-   data/FOO.txt.i at 0: missing revlog!
-   data/QUICK.txt.i at 0: missing revlog!
+   data/1234567.9/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.i: found missing revlog
+   data/FOO.txt.i: found missing revlog
+   data/QUICK.txt.i: found missing revlog
    0: empty or missing QUICK.txt
    QUICK.txt at 0: 88b857db8eba in manifests not found
-   data/bar.txt.i at 0: missing revlog!
+   data/bar.txt.i: found missing revlog
   4 files, 1 changesets, 3 total revisions
-  6 integrity errors encountered!
+  4 warnings encountered!
+  2 integrity errors encountered!
+  (first damaged changeset appears to be 0)
+  [1]
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+   data/QUICK.txt.i: found missing revlog
+   0: empty or missing QUICK.txt
+   QUICK.txt at 0: 88b857db8eba in manifests not found
+  4 files, 1 changesets, 3 total revisions
+  1 warnings encountered!
+  2 integrity errors encountered!
   (first damaged changeset appears to be 0)
   [1]
   $ mv _q_u_i_c_k.txt.i .hg/store/data/


More information about the Mercurial-devel mailing list