From patchwork Tue Aug 14 16:39:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6,of,8] revlog: do not search for delta for empty content From: Boris Feld X-Patchwork-Id: 33725 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Tue, 14 Aug 2018 18:39:16 +0200 # HG changeset patch # User Boris Feld # 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