changeset 1659:bfa90d9a3b77

Add revlog version signature check
author Matt Mackall <mpm@selenic.com>
date Sun, 29 Jan 2006 20:27:58 +1300
parents f5e194047f1e
children b2df93c56ac4
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sun Jan 29 20:13:43 2006 +1300
+++ b/mercurial/revlog.py	Sun Jan 29 20:27:58 2006 +1300
@@ -197,6 +197,10 @@
                 raise
             i = ""
 
+        if i[:4] != "\0\0\0\0":
+            raise RevlogError(_("incompatible revlog signature on %s") %
+                              self.indexfile)
+
         if len(i) > 10000:
             # big index, let's parse it on demand
             parser = lazyparser(i, self)