Patchwork [13,of,19] snapshot: turn _refinedgroups into a coroutine

login
register
mail settings
Submitter Boris Feld
Date Sept. 8, 2018, 10:57 a.m.
Message ID <4c849d34990166b12464.1536404227@localhost.localdomain>
Download mbox | patch
Permalink /patch/34436/
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 1536333454 14400
#      Fri Sep 07 11:17:34 2018 -0400
# Node ID 4c849d34990166b1246426533efa517733d8a7fe
# Parent  f79dc24022976ab6ba0a8f7183651e0e4d9877d5
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4c849d349901
snapshot: turn _refinedgroups into a coroutine

We are now almost ready to start adding refining logic.

Patch

diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -589,7 +589,7 @@  def _candidategroups(revlog, textlen, p1
     tested = set([nullrev])
     candidates = _refinedgroups(revlog, p1, p2, cachedelta)
     while True:
-        temptative = next(candidates)
+        temptative = candidates.send(good)
         if temptative is None:
             break
         group = []
@@ -618,8 +618,6 @@  def _candidategroups(revlog, textlen, p1
             #      impacting performances. Some bounding or slicing mecanism
             #      would help to reduce this impact.
             good = yield tuple(group)
-        if good is not None:
-            break
     yield None
 
 def _findsnapshots(revlog, cache, start_rev):