Mercurial > hg
changeset 42103:362726923ba3
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.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Thu, 11 Apr 2019 18:10:07 +0200 |
parents | 976f069e0ad6 |
children | 4b86f4f199a9 |
files | mercurial/setdiscovery.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/setdiscovery.py Wed Apr 10 17:36:37 2019 -0700 +++ b/mercurial/setdiscovery.py Thu Apr 11 18:10:07 2019 +0200 @@ -160,6 +160,11 @@ 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 @@ 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)