# HG changeset patch # User Georges Racinet # Date 2019-04-11 16:10:07 # Node ID 362726923ba3671b741e345cacf07f6abef27661 # Parent 976f069e0ad6dd14aec08d764918fac336c03211 discovery: stop direct use of attribute of partialdiscovery Instead of accessing `undecided` directly for ui display purposes, we introduce a `stats()` method that could be extended in the future with more interesting information. This is in preparation for a forthcoming Rust version of this object. Indeed, attributes and furthermore properties are a bit complicated for classes in native code. We could go further and rename `undecided` to mark it private, but `_undecided` is already taken as support for `_undecided` lazyness. diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -160,6 +160,11 @@ class partialdiscovery(object): self._undecided = set(self._common.missingancestors(self._targetheads)) return self._undecided + def stats(self): + return { + 'undecided': len(self.undecided), + } + def commonheads(self): """the heads of the known common set""" # heads(common) == heads(common.bases) since common represents @@ -339,8 +344,10 @@ def findcommonheads(ui, local, remote, roundtrips += 1 progress.update(roundtrips) + stats = disco.stats() ui.debug("query %i; still undecided: %i, sample size is: %i\n" - % (roundtrips, len(disco.undecided), len(sample))) + % (roundtrips, stats['undecided'], len(sample))) + # indices between sample and externalized version must match sample = list(sample)