Patchwork [1,of,2,FOLLOW-UP] snapshot: fix line order when skipping over empty deltas

mail settings
Submitter Boris Feld
Date Sept. 13, 2018, 2:27 p.m.
Message ID <bf9d5d5513d0babd5e1d.1536848872@localhost.localdomain>
Download mbox | patch
Permalink /patch/34604/
State Accepted
Headers show


Boris Feld - Sept. 13, 2018, 2:27 p.m.
# HG changeset patch
# User Boris Feld <>
# Date 1536567081 -7200
#      Mon Sep 10 10:11:21 2018 +0200
# Node ID bf9d5d5513d0babd5e1d59df1c1fa26c244faae5
# Parent  9db85644629855cd1064bfdedf1844db0f981ed9
# EXP-Topic sparse-snapshot
# Available At
#              hg pull -r bf9d5d5513d0
snapshot: fix line order when skipping over empty deltas

The code movement in 37957e07138c introduced an error.

Since 8f83a953dddf, we discarded some revisions because they are identical to
their delta base (and use that delta base instead). That logic is good,
however, in 37957e07138c we mixed up the order of two line, adding the "new"
revision to the set of already tested one, instead of the discarded one. So in
practice, we were never investigating any revisions in a chain starting with
an empty delta. Creating significantly worst delta chain (eg: Mercurial's
manifest move goes from about 60MB up to about 80MB).


diff --git a/mercurial/revlogutils/ b/mercurial/revlogutils/
--- a/mercurial/revlogutils/
+++ b/mercurial/revlogutils/
@@ -596,8 +596,8 @@  def _candidategroups(revlog, textlen, p1
         for rev in temptative:
             # skip over empty delta (no need to include them in a chain)
             while not (rev == nullrev or rev in tested or deltalength(rev)):
+                tested.add(rev)
                 rev = deltaparent(rev)
-                tested.add(rev)
             # filter out revision we tested already
             if rev in tested: