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

login
register
mail settings
Submitter Gregory Szorc
Date Oct. 2, 2016, 5:33 p.m.
Message ID <b4ca569d38c9e35f542b.1475429589@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/16821/
State Superseded
Headers show

Comments

Gregory Szorc - Oct. 2, 2016, 5:33 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.

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