[PATCH 1 of 2 V2] revlog: add instance variable controlling delta chain use

Gregory Szorc gregory.szorc at gmail.com
Sun Oct 2 17:33:09 UTC 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1474745137 25200
#      Sat Sep 24 12:25:37 2016 -0700
# Node ID b4ca569d38c9e35f542b90868f86247ad8844b4c
# Parent  19378039ce2185cd5bab5f574c656da9307f2ee2
revlog: add instance variable controlling delta chain use

This is to support disabling delta chains on the changelog in a
subsequent patch.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -292,16 +292,18 @@ class revlog(object):
                               % (self.indexfile, flags >> 16))
         elif fmt == REVLOGNG and flags & ~REVLOGNG_FLAGS:
             raise RevlogError(_("index %s unknown flags %#04x for revlogng")
                               % (self.indexfile, flags >> 16))
         elif fmt > REVLOGNG:
             raise RevlogError(_("index %s unknown format %d")
                               % (self.indexfile, fmt))
 
+        self._storedeltachains = True
+
         self._io = revlogio()
         if self.version == REVLOGV0:
             self._io = revlogoldio()
         try:
             d = self._io.parseindex(indexdata, self._inline)
         except (ValueError, IndexError):
             raise RevlogError(_("index %s is corrupted") % (self.indexfile))
         self.index, nodemap, self._chunkcache = d
@@ -1464,17 +1466,17 @@ class revlog(object):
         # become comparable to the uncompressed text
         if text is None:
             textlen = mdiff.patchedsize(self.rawsize(cachedelta[0]),
                                         cachedelta[1])
         else:
             textlen = len(text)
 
         # should we try to build a delta?
-        if prev != nullrev:
+        if prev != nullrev and self._storedeltachains:
             tested = set()
             # This condition is true most of the time when processing
             # changegroup data into a generaldelta repo. The only time it
             # isn't true is if this is the first revision in a delta chain
             # or if ``format.generaldelta=true`` disabled ``lazydeltabase``.
             if cachedelta and self._generaldelta and self._lazydeltabase:
                 # Assume what we received from the server is a good choice
                 # build delta will reuse the cache


More information about the Mercurial-devel mailing list