[PATCH 6 of 8] revlog: do not search for delta for empty content
Boris Feld
boris.feld at octobus.net
Tue Aug 14 12:39:16 EDT 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1532695051 -7200
# Fri Jul 27 14:37:31 2018 +0200
# Node ID e7eddd3944f5a2dd8235f372c175b3688a17ef0c
# Parent 130de8bf42ff740783b99c4996c0f774e27e67cf
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e7eddd3944f5
revlog: do not search for delta for empty content
We won't find any useful base to store an empty text. So we should not even try
to.
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -738,6 +738,9 @@ class _deltacomputer(object):
Returns the first acceptable candidate revision, as ordered by
_getcandidaterevs
"""
+ if not revinfo.textlen:
+ return None # empty file do not need delta
+
cachedelta = revinfo.cachedelta
p1 = revinfo.p1
p2 = revinfo.p2
More information about the Mercurial-devel
mailing list