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

Boris Feld boris.feld at octobus.net
Sat Sep 8 06:57:07 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at 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.

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):


More information about the Mercurial-devel mailing list