Patchwork D2647: setdiscovery: make progress on each connected group each roundtrip

login
register
mail settings
Submitter phabricator
Date May 21, 2019, 6:09 p.m.
Message ID <ff7912968c527eae3af4d90ad560f76d@localhost.localdomain>
Download mbox | patch
Permalink /patch/40167/
State Not Applicable
Headers show

Comments

phabricator - May 21, 2019, 6:09 p.m.
martinvonz updated this revision to Diff 15208.
martinvonz edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2647?vs=14801&id=15208

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

AFFECTED FILES
  mercurial/setdiscovery.py
  tests/test-setdiscovery.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t
--- a/tests/test-setdiscovery.t
+++ b/tests/test-setdiscovery.t
@@ -974,16 +974,16 @@ 
   searching for changes
   taking quick initial sample
   searching: 2 queries
-  query 2; still undecided: 1080, sample size is: 100
+  query 2; still undecided: 1080, sample size is: 260
   sampling from both directions
   searching: 3 queries
-  query 3; still undecided: 980, sample size is: 200
+  query 3; still undecided: 820, sample size is: 260
   sampling from both directions
   searching: 4 queries
   query 4; still undecided: \d+, sample size is: 200 (re)
   sampling from both directions
   searching: 5 queries
-  query 5; still undecided: 195, sample size is: 195
+  query 5; still undecided: 4, sample size is: 4
   5 total queries in *.????s (glob)
   elapsed time:  * seconds (glob)
   heads summary:
diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -110,13 +110,14 @@ 
     (all tracked revisions are known locally)
     """
 
-    def __init__(self, repo, targetheads):
+    def __init__(self, repo, targetheads, limitedarguments):
         self._repo = repo
         self._targetheads = targetheads
         self._common = repo.changelog.incrementalmissingrevs()
         self._undecided = None
         self.missing = set()
         self._childrenmap = None
+        self._limitedarguments = limitedarguments
 
     def addcommons(self, commons):
         """register nodes known as common"""
@@ -219,6 +220,8 @@ 
         if len(revs) <= size:
             return list(revs)
         sample = set(self._repo.revs('heads(%ld)', revs))
+        if not self._limitedarguments:
+            size = max(size, len(sample))
 
         if len(sample) >= size:
             return _limitsample(sample, size)
@@ -233,6 +236,8 @@ 
             return list(revs)
         repo = self._repo
         sample = set(repo.revs('heads(%ld)', revs))
+        if not self._limitedarguments:
+            size = max(size, len(sample))
         parentrevs = self._parentsgetter()
 
         # update from heads
@@ -372,7 +377,7 @@ 
 
     # full blown discovery
 
-    disco = partialdiscovery(local, ownheads)
+    disco = partialdiscovery(local, ownheads, remote.limitedarguments)
     # treat remote heads (and maybe own heads) as a first implicit sample
     # response
     disco.addcommons(knownsrvheads)