changeset 41169:3ce5b96482c6

discovery: add a `iscomplete` method to the `partialdiscovery` object The method is used by higher level logic to know if the initial discovery question has been answered.
author Boris Feld <boris.feld@octobus.net>
date Fri, 28 Dec 2018 03:39:43 +0100
parents 1d30be90c9dc
children 96201120cdf5
files mercurial/setdiscovery.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Fri Dec 28 03:34:23 2018 +0100
+++ b/mercurial/setdiscovery.py	Fri Dec 28 03:39:43 2018 +0100
@@ -186,6 +186,10 @@
         """return True is we have any clue about the remote state"""
         return self._common.hasbases()
 
+    def iscomplete(self):
+        """True if all the necessary data have been gathered"""
+        return self._undecided is not None and not self._undecided
+
     @property
     def undecided(self):
         if self._undecided is not None:
@@ -278,7 +282,7 @@
 
     full = False
     progress = ui.makeprogress(_('searching'), unit=_('queries'))
-    while disco.undecided:
+    while not disco.iscomplete():
 
         if sample:
             missinginsample = [n for i, n in enumerate(sample) if not yesno[i]]
@@ -291,7 +295,7 @@
 
             disco.undecided.difference_update(missing)
 
-        if not disco.undecided:
+        if disco.iscomplete():
             break
 
         if full or disco.hasinfo():