changeset 39516:51cec7fb672e

snapshot: also use None as a stop value for `_refinegroup` This is yet another small step toward turning `_refinegroups` into a co-routine.
author Boris Feld <boris.feld@octobus.net>
date Fri, 07 Sep 2018 11:17:33 -0400
parents 04b75f3a3f2a
children cc85ebb68ff9
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Fri Sep 07 11:17:33 2018 -0400
+++ b/mercurial/revlogutils/deltas.py	Fri Sep 07 11:17:33 2018 -0400
@@ -587,7 +587,11 @@
     deltas_limit = textlen * LIMIT_DELTA2TEXT
 
     tested = set([nullrev])
-    for temptative in _refinedgroups(revlog, p1, p2, cachedelta):
+    candidates = _refinedgroups(revlog, p1, p2, cachedelta)
+    while True:
+        temptative = next(candidates)
+        if temptative is None:
+            break
         group = []
         for rev in temptative:
             # skip over empty delta (no need to include them in a chain)
@@ -632,6 +636,8 @@
         good = yield candidates
         if good is not None:
             break
+    # we have found nothing
+    yield None
 
 def _rawgroups(revlog, p1, p2, cachedelta):
     """Provides group of revision to be tested as delta base