[PATCH 3 of 4] revlog: add instance variable controlling delta chain use
Gregory Szorc
gregory.szorc at gmail.com
Sat Sep 24 15:37:18 EDT 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 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
More information about the Mercurial-devel
mailing list