changeset 1853:5ac811b720de

Fix some problems when working on broken repositories: Fix tracebacks in hg verify for certain repo errors. Print compression type byte encoded safely.
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 08 Mar 2006 00:27:23 +0100
parents fdf9cbf56ec7
children 638b1bc6c6c9 848152a2e67f
files mercurial/localrepo.py mercurial/revlog.py
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Mar 07 22:41:24 2006 +0100
+++ b/mercurial/localrepo.py	Wed Mar 08 00:27:23 2006 +0100
@@ -1771,6 +1771,7 @@
                 raise
             except Exception, inst:
                 err(_("unpacking changeset %s: %s") % (short(n), inst))
+                continue
 
             neededmanifests[changes[0]] = n
 
@@ -1808,10 +1809,14 @@
                 raise
             except Exception, inst:
                 err(_("unpacking manifest %s: %s") % (short(n), inst))
+                continue
 
-            ff = [ l.split('\0') for l in delta.splitlines() ]
-            for f, fn in ff:
-                filenodes.setdefault(f, {})[bin(fn[:40])] = 1
+            try:
+                ff = [ l.split('\0') for l in delta.splitlines() ]
+                for f, fn in ff:
+                    filenodes.setdefault(f, {})[bin(fn[:40])] = 1
+            except (ValueError, TypeError), inst:
+                err(_("broken delta in manifest %s: %s") % (short(n), inst))
 
         self.ui.status(_("crosschecking files in changesets and manifests\n"))
 
@@ -1835,6 +1840,9 @@
             if f == "/dev/null":
                 continue
             files += 1
+            if not f:
+                err(_("file without name in manifest %s") % short(n))
+                continue
             fl = self.file(f)
             checksize(fl, f)
 
@@ -1852,7 +1860,7 @@
                     del filenodes[f][n]
 
                 flr = fl.linkrev(n)
-                if flr not in filelinkrevs[f]:
+                if flr not in filelinkrevs.get(f, []):
                     err(_("%s:%s points to unexpected changeset %d")
                             % (f, short(n), flr))
                 else:
--- a/mercurial/revlog.py	Tue Mar 07 22:41:24 2006 +0100
+++ b/mercurial/revlog.py	Wed Mar 08 00:27:23 2006 +0100
@@ -48,7 +48,7 @@
     if t == '\0': return bin
     if t == 'x': return zlib.decompress(bin)
     if t == 'u': return bin[1:]
-    raise RevlogError(_("unknown compression type %s") % t)
+    raise RevlogError(_("unknown compression type %r") % t)
 
 indexformat = ">4l20s20s20s"