changelog: don't use generaldelta
authorSune Foldager <cryo@cyanite.org>
Mon, 16 May 2011 13:06:48 +0200
changeset 14334 85c82ebc96a3
parent 14333 31a5973fcf96
child 14335 220f31030e7f
changelog: don't use generaldelta
mercurial/changelog.py
mercurial/revlog.py
--- a/mercurial/changelog.py	Mon May 16 12:44:34 2011 +0200
+++ b/mercurial/changelog.py	Mon May 16 13:06:48 2011 +0200
@@ -100,6 +100,10 @@
 class changelog(revlog.revlog):
     def __init__(self, opener):
         revlog.revlog.__init__(self, opener, "00changelog.i")
+        if self._initempty:
+            # changelogs don't benefit from generaldelta
+            self.version &= ~revlog.REVLOGGENERALDELTA
+            self._generaldelta = False
         self._realopener = opener
         self._delayed = False
         self._divert = False
--- a/mercurial/revlog.py	Mon May 16 12:44:34 2011 +0200
+++ b/mercurial/revlog.py	Mon May 16 13:06:48 2011 +0200
@@ -234,12 +234,14 @@
                 v = 0
 
         i = ''
+        self._initempty = True
         try:
             f = self.opener(self.indexfile)
             i = f.read()
             f.close()
             if len(i) > 0:
                 v = struct.unpack(versionformat, i[:4])[0]
+                self._initempty = False
         except IOError, inst:
             if inst.errno != errno.ENOENT:
                 raise