Patchwork D6228: discovery: stop direct use of attribute of partialdiscovery

login
register
mail settings
Submitter phabricator
Date April 12, 2019, 6:33 p.m.
Message ID <differential-rev-PHID-DREV-xw72bzm4ectxeqcpyrea-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39573/
State Superseded
Headers show

Comments

phabricator - April 12, 2019, 6:33 p.m.
gracinet created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6228

AFFECTED FILES
  mercurial/setdiscovery.py

CHANGE DETAILS




To: gracinet, #hg-reviewers
Cc: mercurial-devel
phabricator - April 12, 2019, 6:35 p.m.
gracinet added a subscriber: pulkit.
gracinet added a comment.


  Oops sorry, this one has already been queued by @pulkit (sent it by email, but it was still a draft in my stack).

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6228

To: gracinet, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - April 13, 2019, 1:31 p.m.
pulkit added a comment.


  In https://phab.mercurial-scm.org/D6228#90671, @gracinet wrote:
  
  > Oops sorry, this one has already been queued by @pulkit (sent it by email, but it was still a draft in my stack).
  
  
  Can be marked as Abandoned.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6228

To: gracinet, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - April 15, 2019, 9:37 a.m.
gracinet abandoned this revision.
gracinet added a comment.


  @pulkit, thanks, abandoned this one.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6228

To: gracinet, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -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)