Patchwork [17,of,19] snapshot: extract parent chain computation

login
register
mail settings
Submitter Boris Feld
Date Sept. 8, 2018, 10:57 a.m.
Message ID <535a778ae14a756b2079.1536404231@localhost.localdomain>
Download mbox | patch
Permalink /patch/34440/
State Accepted
Headers show

Comments

Boris Feld - Sept. 8, 2018, 10:57 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1536333457 14400
#      Fri Sep 07 11:17:37 2018 -0400
# Node ID 535a778ae14a756b207901db5b3c0e5a078ae6cd
# Parent  2ad2e932a5e2bb5bbf2bac7b7d3870ba969c07d6
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 535a778ae14a
snapshot: extract parent chain computation

The final step of this series is to include chain related to "prev" in the
search. Before adding that code we do some simple code movement to clarify the
next diff.

Patch

diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -711,8 +711,9 @@  def _rawgroups(revlog, p1, p2, cachedelt
         # search for snapshot in parents delta chain
         # map: snapshot-level: snapshot-rev
         parents_snaps = collections.defaultdict(set)
-        for p in parents:
-            for idx, s in enumerate(deltachain(p)):
+        candidate_chains = [deltachain(p) for p in parents]
+        for chain in candidate_chains:
+            for idx, s in enumerate(chain):
                 if not revlog.issnapshot(s):
                     break
                 parents_snaps[idx].add(s)