From patchwork Sat Sep 24 19:37:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,4] revlog: add instance variable controlling delta chain use From: Gregory Szorc X-Patchwork-Id: 16781 Message-Id: <712281c3ab4b6e6e8ae1.1474745838@ubuntu-vm-main> To: mercurial-devel@mercurial-scm.org Date: Sat, 24 Sep 2016 12:37:18 -0700 # HG changeset patch # User Gregory Szorc # Date 1474745137 25200 # Sat Sep 24 12:25:37 2016 -0700 # Node ID 712281c3ab4b6e6e8ae109fa0673d4d6321d82fd # Parent af899e2937e1a8058e82e3eaf6b2160f6cf98fa9 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 @@ -1463,17 +1465,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() 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 candidatedelta = builddelta(cachedelta[0]) tested.add(cachedelta[0]) if self._isgooddelta(candidatedelta, textlen): delta = candidatedelta