[PATCH 3 of 5] verify: avoid exception on missing file revlog

Henrik Stuart hg at hstuart.dk
Fri Apr 24 04:42:35 CDT 2009


# HG changeset patch
# User Henrik Stuart <hg at hstuart.dk>
# Date 1240562679 -7200
# Node ID 4288996fcb457fbccbb6965efa70a09edb70eabc
# Parent  4537ce739493b15d48e19d4c75bef0bfa45ec7e6
verify: avoid exception on missing file revlog

Previously, accessing the filelinkrevs of a specific file that happens to
have already been unlinked from the filesystem, e.g. due to a partial rollback
having occurred, will trigger a KeyError being raised.

Co-contributor: Sune Foldager <cryo at cyanite.org>

diff -r 4537ce739493 -r 4288996fcb45 mercurial/verify.py
--- a/mercurial/verify.py	Sun Apr 19 20:02:32 2009 +0200
+++ b/mercurial/verify.py	Fri Apr 24 10:44:39 2009 +0200
@@ -173,6 +173,10 @@
 
     files = util.sort(util.unique(filenodes.keys() + filelinkrevs.keys()))
     for f in files:
+        if f not in filelinkrevs:
+            err(None, _("missing revlog for file '%s'") % f)
+            continue
+
         lr = filelinkrevs[f][0]
         try:
             fl = repo.file(f)


More information about the Mercurial-devel mailing list