snapshot: also use None as a stop value for `_refinegroup`
authorBoris Feld <boris.feld@octobus.net>
Fri, 07 Sep 2018 11:17:33 -0400
changeset 39499 51cec7fb672e
parent 39498 04b75f3a3f2a
child 39500 cc85ebb68ff9
snapshot: also use None as a stop value for `_refinegroup` This is yet another small step toward turning `_refinegroups` into a co-routine.
mercurial/revlogutils/deltas.py
--- 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