Show More
@@ -91,15 +91,27 b' def findcommonheads(ui, local, remote,' | |||
|
91 | 91 | roundtrips = 0 |
|
92 | 92 | cl = local.changelog |
|
93 | 93 | dag = dagutil.revlogdag(cl) |
|
94 | nodes = dag.nodeset() | |
|
95 | 94 | |
|
96 |
# early exit if we know all the specified |
|
|
95 | # early exit if we know all the specified remote heads already | |
|
97 | 96 | ui.debug("query 1; heads\n") |
|
98 | 97 | roundtrips += 1 |
|
98 | ownheads = dag.heads() | |
|
99 | sample = ownheads | |
|
100 | if remote.local(): | |
|
101 | # stopgap until we have a proper localpeer that supports batch() | |
|
99 | 102 | srvheadhashes = remote.heads() |
|
100 | ||
|
101 | ## TODO We might want to request an additional random sample of the server's | |
|
102 | ## nodes batched with the heads query here. | |
|
103 | yesno = remote.known(dag.externalizeall(sample)) | |
|
104 | elif remote.capable('batch'): | |
|
105 | batch = remote.batch() | |
|
106 | srvheadhashesref = batch.heads() | |
|
107 | yesnoref = batch.known(dag.externalizeall(sample)) | |
|
108 | batch.submit() | |
|
109 | srvheadhashes = srvheadhashesref.value | |
|
110 | yesno = yesnoref.value | |
|
111 | else: | |
|
112 | # compatibitity with pre-batch, but post-known remotes during 1.9 devel | |
|
113 | srvheadhashes = remote.heads() | |
|
114 | sample = [] | |
|
103 | 115 | |
|
104 | 116 | if cl.tip() == nullid: |
|
105 | 117 | if srvheadhashes != [nullid]: |
@@ -115,32 +127,24 b' def findcommonheads(ui, local, remote,' | |||
|
115 | 127 | ui.note("all remote heads known locally\n") |
|
116 | 128 | return (srvheadhashes, False, srvheadhashes,) |
|
117 | 129 | |
|
130 | if sample and util.all(yesno): | |
|
131 | ui.note("all local heads known remotely\n") | |
|
132 | ownheadhashes = dag.externalizeall(ownheads) | |
|
133 | return (ownheadhashes, True, srvheadhashes,) | |
|
134 | ||
|
118 | 135 | # full blown discovery |
|
119 |
undecided = nodes # own nodes where I don't know if |
|
|
136 | undecided = dag.nodeset() # own nodes where I don't know if remote knows them | |
|
120 | 137 | common = set() # own nodes I know we both know |
|
121 |
missing = set() # own nodes I know |
|
|
138 | missing = set() # own nodes I know remote lacks | |
|
122 | 139 | |
|
123 | # treat remote heads as a first implicit sample response | |
|
140 | # treat remote heads (and maybe own heads) as a first implicit sample response | |
|
124 | 141 | common.update(dag.ancestorset(srvheads)) |
|
125 | 142 | undecided.difference_update(common) |
|
126 | # use cheapish initial sample | |
|
127 | if common: | |
|
128 | ui.debug("taking initial sample\n") | |
|
129 | sample = _takefullsample(dag, undecided, size=fullsamplesize) | |
|
130 | else: | |
|
131 | ui.debug("taking quick initial sample\n") | |
|
132 | sample = _takequicksample(dag, nodes, size=initialsamplesize, | |
|
133 | initial=True) | |
|
134 | 143 | |
|
135 | roundtrips += 1 | |
|
136 | ui.progress(_('searching'), roundtrips, unit=_('queries')) | |
|
137 | ui.debug("query %i; still undecided: %i, sample size is: %i\n" | |
|
138 | % (roundtrips, len(undecided), len(sample))) | |
|
139 | # indices between sample and externalized version must match | |
|
140 | sample = list(sample) | |
|
141 | yesno = remote.known(dag.externalizeall(sample)) | |
|
144 | full = False | |
|
145 | while undecided: | |
|
142 | 146 | |
|
143 | while undecided: | |
|
147 | if sample: | |
|
144 | 148 | commoninsample = set(n for i, n in enumerate(sample) if yesno[i]) |
|
145 | 149 | common.update(dag.ancestorset(commoninsample, common)) |
|
146 | 150 | |
@@ -153,8 +157,18 b' def findcommonheads(ui, local, remote,' | |||
|
153 | 157 | if not undecided: |
|
154 | 158 | break |
|
155 | 159 | |
|
160 | if full: | |
|
156 | 161 | ui.note("sampling from both directions\n") |
|
157 | 162 | sample = _takefullsample(dag, undecided, size=fullsamplesize) |
|
163 | elif common: | |
|
164 | # use cheapish initial sample | |
|
165 | ui.debug("taking initial sample\n") | |
|
166 | sample = _takefullsample(dag, undecided, size=fullsamplesize) | |
|
167 | else: | |
|
168 | # use even cheaper initial sample | |
|
169 | ui.debug("taking quick initial sample\n") | |
|
170 | sample = _takequicksample(dag, undecided, size=initialsamplesize, | |
|
171 | initial=True) | |
|
158 | 172 | |
|
159 | 173 | roundtrips += 1 |
|
160 | 174 | ui.progress(_('searching'), roundtrips, unit=_('queries')) |
@@ -163,6 +177,7 b' def findcommonheads(ui, local, remote,' | |||
|
163 | 177 | # indices between sample and externalized version must match |
|
164 | 178 | sample = list(sample) |
|
165 | 179 | yesno = remote.known(dag.externalizeall(sample)) |
|
180 | full = True | |
|
166 | 181 | |
|
167 | 182 | result = dag.headsetofconnecteds(common) |
|
168 | 183 | ui.progress(_('searching'), None) |
@@ -102,19 +102,19 b' do not use the proxy if it is in the no ' | |||
|
102 | 102 | * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob) |
|
103 | 103 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob) |
|
104 | 104 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
105 |
* - - [*] "GET http://localhost:$HGPORT/?cmd= |
|
|
105 | * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) | |
|
106 | 106 | * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob) |
|
107 | 107 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob) |
|
108 | 108 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
109 |
* - - [*] "GET http://localhost:$HGPORT/?cmd= |
|
|
109 | * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) | |
|
110 | 110 | * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob) |
|
111 | 111 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob) |
|
112 | 112 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
113 |
* - - [*] "GET http://localhost:$HGPORT/?cmd= |
|
|
113 | * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) | |
|
114 | 114 | * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob) |
|
115 | 115 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob) |
|
116 | 116 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
117 |
* - - [*] "GET http://localhost:$HGPORT/?cmd= |
|
|
117 | * - - [*] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) | |
|
118 | 118 | * - - [*] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629 (glob) |
|
119 | 119 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob) |
|
120 | 120 |
@@ -35,7 +35,7 b'' | |||
|
35 | 35 | searching for changes |
|
36 | 36 | taking quick initial sample |
|
37 | 37 | searching: 2 queries |
|
38 |
query 2; still undecided: |
|
|
38 | query 2; still undecided: 1, sample size is: 1 | |
|
39 | 39 | 2 total queries |
|
40 | 40 | new remote heads on branch 'default' |
|
41 | 41 | new remote head 1e108cc5548c |
@@ -28,7 +28,7 b' check that {1} syntax works' | |||
|
28 | 28 | sending capabilities command |
|
29 | 29 | comparing with parts://localhost/ |
|
30 | 30 | query 1; heads |
|
31 |
sending |
|
|
31 | sending batch command | |
|
32 | 32 | searching for changes |
|
33 | 33 | all remote heads known locally |
|
34 | 34 | no changes found |
@@ -44,10 +44,7 b' Small superset:' | |||
|
44 | 44 | comparing with b |
|
45 | 45 | query 1; heads |
|
46 | 46 | searching for changes |
|
47 | taking initial sample | |
|
48 | searching: 2 queries | |
|
49 | query 2; still undecided: 4, sample size is: 4 | |
|
50 | 2 total queries | |
|
47 | all local heads known remotely | |
|
51 | 48 | common heads: b5714e113bc0 01241442b3c2 |
|
52 | 49 | local is subset |
|
53 | 50 | |
@@ -83,9 +80,9 b' Many new:' | |||
|
83 | 80 | comparing with b |
|
84 | 81 | query 1; heads |
|
85 | 82 | searching for changes |
|
86 |
taking |
|
|
83 | taking initial sample | |
|
87 | 84 | searching: 2 queries |
|
88 |
query 2; still undecided: |
|
|
85 | query 2; still undecided: 29, sample size is: 29 | |
|
89 | 86 | 2 total queries |
|
90 | 87 | common heads: bebd167eb94d |
|
91 | 88 | |
@@ -101,7 +98,7 b' Many new:' | |||
|
101 | 98 | searching for changes |
|
102 | 99 | taking initial sample |
|
103 | 100 | searching: 2 queries |
|
104 |
query 2; |
|
|
101 | query 2; still undecided: 2, sample size is: 2 | |
|
105 | 102 | 2 total queries |
|
106 | 103 | common heads: bebd167eb94d |
|
107 | 104 | |
@@ -122,9 +119,9 b' Both sides many new with stub:' | |||
|
122 | 119 | comparing with b |
|
123 | 120 | query 1; heads |
|
124 | 121 | searching for changes |
|
125 |
taking |
|
|
122 | taking initial sample | |
|
126 | 123 | searching: 2 queries |
|
127 |
query 2; still undecided: |
|
|
124 | query 2; still undecided: 29, sample size is: 29 | |
|
128 | 125 | 2 total queries |
|
129 | 126 | common heads: 2dc09a01254d |
|
130 | 127 | |
@@ -140,7 +137,7 b' Both sides many new with stub:' | |||
|
140 | 137 | searching for changes |
|
141 | 138 | taking initial sample |
|
142 | 139 | searching: 2 queries |
|
143 |
query 2; |
|
|
140 | query 2; still undecided: 29, sample size is: 29 | |
|
144 | 141 | 2 total queries |
|
145 | 142 | common heads: 2dc09a01254d |
|
146 | 143 | |
@@ -163,7 +160,7 b' Both many new:' | |||
|
163 | 160 | searching for changes |
|
164 | 161 | taking quick initial sample |
|
165 | 162 | searching: 2 queries |
|
166 |
query 2; still undecided: 3 |
|
|
163 | query 2; still undecided: 31, sample size is: 31 | |
|
167 | 164 | 2 total queries |
|
168 | 165 | common heads: 66f7d451a68b |
|
169 | 166 | |
@@ -179,7 +176,7 b' Both many new:' | |||
|
179 | 176 | searching for changes |
|
180 | 177 | taking quick initial sample |
|
181 | 178 | searching: 2 queries |
|
182 |
query 2; still undecided: 3 |
|
|
179 | query 2; still undecided: 31, sample size is: 31 | |
|
183 | 180 | 2 total queries |
|
184 | 181 | common heads: 66f7d451a68b |
|
185 | 182 | |
@@ -202,7 +199,7 b' Both many new skewed:' | |||
|
202 | 199 | searching for changes |
|
203 | 200 | taking quick initial sample |
|
204 | 201 | searching: 2 queries |
|
205 |
query 2; still undecided: 5 |
|
|
202 | query 2; still undecided: 51, sample size is: 51 | |
|
206 | 203 | 2 total queries |
|
207 | 204 | common heads: 66f7d451a68b |
|
208 | 205 | |
@@ -218,7 +215,7 b' Both many new skewed:' | |||
|
218 | 215 | searching for changes |
|
219 | 216 | taking quick initial sample |
|
220 | 217 | searching: 2 queries |
|
221 |
query 2; still undecided: 3 |
|
|
218 | query 2; still undecided: 31, sample size is: 31 | |
|
222 | 219 | 2 total queries |
|
223 | 220 | common heads: 66f7d451a68b |
|
224 | 221 | |
@@ -241,7 +238,7 b' Both many new on top of long history:' | |||
|
241 | 238 | searching for changes |
|
242 | 239 | taking quick initial sample |
|
243 | 240 | searching: 2 queries |
|
244 |
query 2; still undecided: 10 |
|
|
241 | query 2; still undecided: 1049, sample size is: 11 | |
|
245 | 242 | sampling from both directions |
|
246 | 243 | searching: 3 queries |
|
247 | 244 | query 3; still undecided: 31, sample size is: 31 |
@@ -260,7 +257,7 b' Both many new on top of long history:' | |||
|
260 | 257 | searching for changes |
|
261 | 258 | taking quick initial sample |
|
262 | 259 | searching: 2 queries |
|
263 |
query 2; still undecided: 10 |
|
|
260 | query 2; still undecided: 1029, sample size is: 11 | |
|
264 | 261 | sampling from both directions |
|
265 | 262 | searching: 3 queries |
|
266 | 263 | query 3; still undecided: 16, sample size is: 16 |
General Comments 0
You need to be logged in to leave comments.
Login now