[PATCH 4 of 6] verify: avoid exception on missing file revlog

Henrik Stuart hg at hstuart.dk
Wed Apr 22 07:58:46 UTC 2009


# HG changeset patch
# User Henrik Stuart <hg at hstuart.dk>
# Date 1240383338 -7200
# Node ID ad6799ba14f825b373aac1f74e9229dc4481e208
# Parent  f8ad118521b5e9fad24b54ea1691b5d4ddb55dde
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 f8ad118521b5 -r ad6799ba14f8 mercurial/verify.py
--- a/mercurial/verify.py	Sun Apr 19 20:02:32 2009 +0200
+++ b/mercurial/verify.py	Wed Apr 22 08:55:38 2009 +0200
@@ -173,6 +173,10 @@
 
     files = util.sort(util.unique(filenodes.keys() + filelinkrevs.keys()))
     for f in files:
+        if not f 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