--- a/mercurial/revlog.py Fri Dec 04 16:45:06 2015 -0800
+++ b/mercurial/revlog.py Fri Dec 04 17:14:14 2015 -0800
@@ -1450,11 +1450,12 @@
if delta is None and prev not in tested:
# other approach failed try against prev to hopefully save us a
# fulltext.
- delta = builddelta(prev)
+ candidatedelta = builddelta(prev)
+ if self._isgooddelta(candidatedelta, textlen):
+ delta = candidatedelta
if delta is not None:
dist, l, data, base, chainbase, chainlen, compresseddeltalen = delta
-
- if not self._isgooddelta(delta, textlen):
+ else:
text = buildtext()
data = self.compress(text)
l = len(data[1]) + len(data[0])