Show More
@@ -1,253 +1,256 b'' | |||||
1 | # setdiscovery.py - improved discovery of common nodeset for mercurial |
|
1 | # setdiscovery.py - improved discovery of common nodeset for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2010 Benoit Boissinot <bboissin@gmail.com> |
|
3 | # Copyright 2010 Benoit Boissinot <bboissin@gmail.com> | |
4 | # and Peter Arrenbrecht <peter@arrenbrecht.ch> |
|
4 | # and Peter Arrenbrecht <peter@arrenbrecht.ch> | |
5 | # |
|
5 | # | |
6 | # This software may be used and distributed according to the terms of the |
|
6 | # This software may be used and distributed according to the terms of the | |
7 | # GNU General Public License version 2 or any later version. |
|
7 | # GNU General Public License version 2 or any later version. | |
8 | """ |
|
8 | """ | |
9 | Algorithm works in the following way. You have two repository: local and |
|
9 | Algorithm works in the following way. You have two repository: local and | |
10 | remote. They both contains a DAG of changelists. |
|
10 | remote. They both contains a DAG of changelists. | |
11 |
|
11 | |||
12 | The goal of the discovery protocol is to find one set of node *common*, |
|
12 | The goal of the discovery protocol is to find one set of node *common*, | |
13 | the set of nodes shared by local and remote. |
|
13 | the set of nodes shared by local and remote. | |
14 |
|
14 | |||
15 | One of the issue with the original protocol was latency, it could |
|
15 | One of the issue with the original protocol was latency, it could | |
16 | potentially require lots of roundtrips to discover that the local repo was a |
|
16 | potentially require lots of roundtrips to discover that the local repo was a | |
17 | subset of remote (which is a very common case, you usually have few changes |
|
17 | subset of remote (which is a very common case, you usually have few changes | |
18 | compared to upstream, while upstream probably had lots of development). |
|
18 | compared to upstream, while upstream probably had lots of development). | |
19 |
|
19 | |||
20 | The new protocol only requires one interface for the remote repo: `known()`, |
|
20 | The new protocol only requires one interface for the remote repo: `known()`, | |
21 | which given a set of changelists tells you if they are present in the DAG. |
|
21 | which given a set of changelists tells you if they are present in the DAG. | |
22 |
|
22 | |||
23 | The algorithm then works as follow: |
|
23 | The algorithm then works as follow: | |
24 |
|
24 | |||
25 | - We will be using three sets, `common`, `missing`, `unknown`. Originally |
|
25 | - We will be using three sets, `common`, `missing`, `unknown`. Originally | |
26 | all nodes are in `unknown`. |
|
26 | all nodes are in `unknown`. | |
27 | - Take a sample from `unknown`, call `remote.known(sample)` |
|
27 | - Take a sample from `unknown`, call `remote.known(sample)` | |
28 | - For each node that remote knows, move it and all its ancestors to `common` |
|
28 | - For each node that remote knows, move it and all its ancestors to `common` | |
29 | - For each node that remote doesn't know, move it and all its descendants |
|
29 | - For each node that remote doesn't know, move it and all its descendants | |
30 | to `missing` |
|
30 | to `missing` | |
31 | - Iterate until `unknown` is empty |
|
31 | - Iterate until `unknown` is empty | |
32 |
|
32 | |||
33 | There are a couple optimizations, first is instead of starting with a random |
|
33 | There are a couple optimizations, first is instead of starting with a random | |
34 | sample of missing, start by sending all heads, in the case where the local |
|
34 | sample of missing, start by sending all heads, in the case where the local | |
35 | repo is a subset, you computed the answer in one round trip. |
|
35 | repo is a subset, you computed the answer in one round trip. | |
36 |
|
36 | |||
37 | Then you can do something similar to the bisecting strategy used when |
|
37 | Then you can do something similar to the bisecting strategy used when | |
38 | finding faulty changesets. Instead of random samples, you can try picking |
|
38 | finding faulty changesets. Instead of random samples, you can try picking | |
39 | nodes that will maximize the number of nodes that will be |
|
39 | nodes that will maximize the number of nodes that will be | |
40 | classified with it (since all ancestors or descendants will be marked as well). |
|
40 | classified with it (since all ancestors or descendants will be marked as well). | |
41 | """ |
|
41 | """ | |
42 |
|
42 | |||
43 | from __future__ import absolute_import |
|
43 | from __future__ import absolute_import | |
44 |
|
44 | |||
45 | import collections |
|
45 | import collections | |
46 | import random |
|
46 | import random | |
47 |
|
47 | |||
48 | from .i18n import _ |
|
48 | from .i18n import _ | |
49 | from .node import ( |
|
49 | from .node import ( | |
50 | nullid, |
|
50 | nullid, | |
51 | nullrev, |
|
51 | nullrev, | |
52 | ) |
|
52 | ) | |
53 | from . import ( |
|
53 | from . import ( | |
54 | dagutil, |
|
54 | dagutil, | |
55 | error, |
|
55 | error, | |
56 | util, |
|
56 | util, | |
57 | ) |
|
57 | ) | |
58 |
|
58 | |||
59 | def _updatesample(dag, nodes, sample, quicksamplesize=0): |
|
59 | def _updatesample(dag, nodes, sample, quicksamplesize=0): | |
60 | """update an existing sample to match the expected size |
|
60 | """update an existing sample to match the expected size | |
61 |
|
61 | |||
62 | The sample is updated with nodes exponentially distant from each head of the |
|
62 | The sample is updated with nodes exponentially distant from each head of the | |
63 | <nodes> set. (H~1, H~2, H~4, H~8, etc). |
|
63 | <nodes> set. (H~1, H~2, H~4, H~8, etc). | |
64 |
|
64 | |||
65 | If a target size is specified, the sampling will stop once this size is |
|
65 | If a target size is specified, the sampling will stop once this size is | |
66 | reached. Otherwise sampling will happen until roots of the <nodes> set are |
|
66 | reached. Otherwise sampling will happen until roots of the <nodes> set are | |
67 | reached. |
|
67 | reached. | |
68 |
|
68 | |||
69 | :dag: a dag object from dagutil |
|
69 | :dag: a dag object from dagutil | |
70 | :nodes: set of nodes we want to discover (if None, assume the whole dag) |
|
70 | :nodes: set of nodes we want to discover (if None, assume the whole dag) | |
71 | :sample: a sample to update |
|
71 | :sample: a sample to update | |
72 | :quicksamplesize: optional target size of the sample""" |
|
72 | :quicksamplesize: optional target size of the sample""" | |
73 | # if nodes is empty we scan the entire graph |
|
73 | # if nodes is empty we scan the entire graph | |
74 | if nodes: |
|
74 | if nodes: | |
75 | heads = dag.headsetofconnecteds(nodes) |
|
75 | heads = dag.headsetofconnecteds(nodes) | |
76 | else: |
|
76 | else: | |
77 | heads = dag.heads() |
|
77 | heads = dag.heads() | |
78 | dist = {} |
|
78 | dist = {} | |
79 | visit = collections.deque(heads) |
|
79 | visit = collections.deque(heads) | |
80 | seen = set() |
|
80 | seen = set() | |
81 | factor = 1 |
|
81 | factor = 1 | |
82 | while visit: |
|
82 | while visit: | |
83 | curr = visit.popleft() |
|
83 | curr = visit.popleft() | |
84 | if curr in seen: |
|
84 | if curr in seen: | |
85 | continue |
|
85 | continue | |
86 | d = dist.setdefault(curr, 1) |
|
86 | d = dist.setdefault(curr, 1) | |
87 | if d > factor: |
|
87 | if d > factor: | |
88 | factor *= 2 |
|
88 | factor *= 2 | |
89 | if d == factor: |
|
89 | if d == factor: | |
90 | sample.add(curr) |
|
90 | sample.add(curr) | |
91 | if quicksamplesize and (len(sample) >= quicksamplesize): |
|
91 | if quicksamplesize and (len(sample) >= quicksamplesize): | |
92 | return |
|
92 | return | |
93 | seen.add(curr) |
|
93 | seen.add(curr) | |
94 | for p in dag.parents(curr): |
|
94 | for p in dag.parents(curr): | |
95 | if not nodes or p in nodes: |
|
95 | if not nodes or p in nodes: | |
96 | dist.setdefault(p, d + 1) |
|
96 | dist.setdefault(p, d + 1) | |
97 | visit.append(p) |
|
97 | visit.append(p) | |
98 |
|
98 | |||
99 | def _takequicksample(dag, nodes, size): |
|
99 | def _takequicksample(dag, nodes, size): | |
100 | """takes a quick sample of size <size> |
|
100 | """takes a quick sample of size <size> | |
101 |
|
101 | |||
102 | It is meant for initial sampling and focuses on querying heads and close |
|
102 | It is meant for initial sampling and focuses on querying heads and close | |
103 | ancestors of heads. |
|
103 | ancestors of heads. | |
104 |
|
104 | |||
105 | :dag: a dag object |
|
105 | :dag: a dag object | |
106 | :nodes: set of nodes to discover |
|
106 | :nodes: set of nodes to discover | |
107 | :size: the maximum size of the sample""" |
|
107 | :size: the maximum size of the sample""" | |
108 | sample = dag.headsetofconnecteds(nodes) |
|
108 | sample = dag.headsetofconnecteds(nodes) | |
109 | if size <= len(sample): |
|
109 | if size <= len(sample): | |
110 | return _limitsample(sample, size) |
|
110 | return _limitsample(sample, size) | |
111 | _updatesample(dag, None, sample, quicksamplesize=size) |
|
111 | _updatesample(dag, None, sample, quicksamplesize=size) | |
112 | return sample |
|
112 | return sample | |
113 |
|
113 | |||
114 | def _takefullsample(dag, nodes, size): |
|
114 | def _takefullsample(dag, nodes, size): | |
115 | sample = dag.headsetofconnecteds(nodes) |
|
115 | sample = dag.headsetofconnecteds(nodes) | |
116 | # update from heads |
|
116 | # update from heads | |
117 | _updatesample(dag, nodes, sample) |
|
117 | _updatesample(dag, nodes, sample) | |
118 | # update from roots |
|
118 | # update from roots | |
119 | _updatesample(dag.inverse(), nodes, sample) |
|
119 | _updatesample(dag.inverse(), nodes, sample) | |
120 | assert sample |
|
120 | assert sample | |
121 | sample = _limitsample(sample, size) |
|
121 | sample = _limitsample(sample, size) | |
122 | if len(sample) < size: |
|
122 | if len(sample) < size: | |
123 | more = size - len(sample) |
|
123 | more = size - len(sample) | |
124 | sample.update(random.sample(list(nodes - sample), more)) |
|
124 | sample.update(random.sample(list(nodes - sample), more)) | |
125 | return sample |
|
125 | return sample | |
126 |
|
126 | |||
127 | def _limitsample(sample, desiredlen): |
|
127 | def _limitsample(sample, desiredlen): | |
128 | """return a random subset of sample of at most desiredlen item""" |
|
128 | """return a random subset of sample of at most desiredlen item""" | |
129 | if len(sample) > desiredlen: |
|
129 | if len(sample) > desiredlen: | |
130 | sample = set(random.sample(sample, desiredlen)) |
|
130 | sample = set(random.sample(sample, desiredlen)) | |
131 | return sample |
|
131 | return sample | |
132 |
|
132 | |||
133 | def findcommonheads(ui, local, remote, |
|
133 | def findcommonheads(ui, local, remote, | |
134 | initialsamplesize=100, |
|
134 | initialsamplesize=100, | |
135 | fullsamplesize=200, |
|
135 | fullsamplesize=200, | |
136 | abortwhenunrelated=True): |
|
136 | abortwhenunrelated=True): | |
137 | '''Return a tuple (common, anyincoming, remoteheads) used to identify |
|
137 | '''Return a tuple (common, anyincoming, remoteheads) used to identify | |
138 | missing nodes from or in remote. |
|
138 | missing nodes from or in remote. | |
139 | ''' |
|
139 | ''' | |
140 | start = util.timer() |
|
140 | start = util.timer() | |
141 |
|
141 | |||
142 | roundtrips = 0 |
|
142 | roundtrips = 0 | |
143 | cl = local.changelog |
|
143 | cl = local.changelog | |
144 | dag = dagutil.revlogdag(cl) |
|
144 | dag = dagutil.revlogdag(cl) | |
145 |
|
145 | |||
146 | # early exit if we know all the specified remote heads already |
|
146 | # early exit if we know all the specified remote heads already | |
147 | ui.debug("query 1; heads\n") |
|
147 | ui.debug("query 1; heads\n") | |
148 | roundtrips += 1 |
|
148 | roundtrips += 1 | |
149 | ownheads = dag.heads() |
|
149 | ownheads = dag.heads() | |
150 | sample = _limitsample(ownheads, initialsamplesize) |
|
150 | sample = _limitsample(ownheads, initialsamplesize) | |
151 | # indices between sample and externalized version must match |
|
151 | # indices between sample and externalized version must match | |
152 | sample = list(sample) |
|
152 | sample = list(sample) | |
153 | batch = remote.iterbatch() |
|
153 | batch = remote.iterbatch() | |
154 | batch.heads() |
|
154 | batch.heads() | |
155 | batch.known(dag.externalizeall(sample)) |
|
155 | batch.known(dag.externalizeall(sample)) | |
156 | batch.submit() |
|
156 | batch.submit() | |
157 | srvheadhashes, yesno = batch.results() |
|
157 | srvheadhashes, yesno = batch.results() | |
158 |
|
158 | |||
159 | if cl.tip() == nullid: |
|
159 | if cl.tip() == nullid: | |
160 | if srvheadhashes != [nullid]: |
|
160 | if srvheadhashes != [nullid]: | |
161 | return [nullid], True, srvheadhashes |
|
161 | return [nullid], True, srvheadhashes | |
162 | return [nullid], False, [] |
|
162 | return [nullid], False, [] | |
163 |
|
163 | |||
164 | # start actual discovery (we note this before the next "if" for |
|
164 | # start actual discovery (we note this before the next "if" for | |
165 | # compatibility reasons) |
|
165 | # compatibility reasons) | |
166 | ui.status(_("searching for changes\n")) |
|
166 | ui.status(_("searching for changes\n")) | |
167 |
|
167 | |||
168 | srvheads = dag.internalizeall(srvheadhashes, filterunknown=True) |
|
168 | srvheads = dag.internalizeall(srvheadhashes, filterunknown=True) | |
169 | if len(srvheads) == len(srvheadhashes): |
|
169 | if len(srvheads) == len(srvheadhashes): | |
170 | ui.debug("all remote heads known locally\n") |
|
170 | ui.debug("all remote heads known locally\n") | |
171 | return (srvheadhashes, False, srvheadhashes,) |
|
171 | return (srvheadhashes, False, srvheadhashes,) | |
172 |
|
172 | |||
173 | if sample and len(ownheads) <= initialsamplesize and all(yesno): |
|
173 | if sample and len(ownheads) <= initialsamplesize and all(yesno): | |
174 | ui.note(_("all local heads known remotely\n")) |
|
174 | ui.note(_("all local heads known remotely\n")) | |
175 | ownheadhashes = dag.externalizeall(ownheads) |
|
175 | ownheadhashes = dag.externalizeall(ownheads) | |
176 | return (ownheadhashes, True, srvheadhashes,) |
|
176 | return (ownheadhashes, True, srvheadhashes,) | |
177 |
|
177 | |||
178 | # full blown discovery |
|
178 | # full blown discovery | |
179 |
|
179 | |||
180 | # own nodes I know we both know |
|
180 | # own nodes I know we both know | |
181 | # treat remote heads (and maybe own heads) as a first implicit sample |
|
181 | # treat remote heads (and maybe own heads) as a first implicit sample | |
182 | # response |
|
182 | # response | |
183 | common = cl.incrementalmissingrevs(srvheads) |
|
183 | common = cl.incrementalmissingrevs(srvheads) | |
184 | commoninsample = set(n for i, n in enumerate(sample) if yesno[i]) |
|
184 | commoninsample = set(n for i, n in enumerate(sample) if yesno[i]) | |
185 | common.addbases(commoninsample) |
|
185 | common.addbases(commoninsample) | |
186 | # own nodes where I don't know if remote knows them |
|
186 | # own nodes where I don't know if remote knows them | |
187 | undecided = set(common.missingancestors(ownheads)) |
|
187 | undecided = set(common.missingancestors(ownheads)) | |
188 | # own nodes I know remote lacks |
|
188 | # own nodes I know remote lacks | |
189 | missing = set() |
|
189 | missing = set() | |
190 |
|
190 | |||
191 | full = False |
|
191 | full = False | |
192 | while undecided: |
|
192 | while undecided: | |
193 |
|
193 | |||
194 | if sample: |
|
194 | if sample: | |
195 | missinginsample = [n for i, n in enumerate(sample) if not yesno[i]] |
|
195 | missinginsample = [n for i, n in enumerate(sample) if not yesno[i]] | |
196 | missing.update(dag.descendantset(missinginsample, missing)) |
|
196 | missing.update(dag.descendantset(missinginsample, missing)) | |
197 |
|
197 | |||
198 | undecided.difference_update(missing) |
|
198 | undecided.difference_update(missing) | |
199 |
|
199 | |||
200 | if not undecided: |
|
200 | if not undecided: | |
201 | break |
|
201 | break | |
202 |
|
202 | |||
203 | if full or common.hasbases(): |
|
203 | if full or common.hasbases(): | |
204 | if full: |
|
204 | if full: | |
205 | ui.note(_("sampling from both directions\n")) |
|
205 | ui.note(_("sampling from both directions\n")) | |
206 | else: |
|
206 | else: | |
207 | ui.debug("taking initial sample\n") |
|
207 | ui.debug("taking initial sample\n") | |
208 | samplefunc = _takefullsample |
|
208 | samplefunc = _takefullsample | |
209 | targetsize = fullsamplesize |
|
209 | targetsize = fullsamplesize | |
210 | else: |
|
210 | else: | |
211 | # use even cheaper initial sample |
|
211 | # use even cheaper initial sample | |
212 | ui.debug("taking quick initial sample\n") |
|
212 | ui.debug("taking quick initial sample\n") | |
213 | samplefunc = _takequicksample |
|
213 | samplefunc = _takequicksample | |
214 | targetsize = initialsamplesize |
|
214 | targetsize = initialsamplesize | |
215 | if len(undecided) < targetsize: |
|
215 | if len(undecided) < targetsize: | |
216 | sample = list(undecided) |
|
216 | sample = list(undecided) | |
217 | else: |
|
217 | else: | |
218 | sample = samplefunc(dag, undecided, targetsize) |
|
218 | sample = samplefunc(dag, undecided, targetsize) | |
219 | sample = _limitsample(sample, targetsize) |
|
219 | sample = _limitsample(sample, targetsize) | |
220 |
|
220 | |||
221 | roundtrips += 1 |
|
221 | roundtrips += 1 | |
222 | ui.progress(_('searching'), roundtrips, unit=_('queries')) |
|
222 | ui.progress(_('searching'), roundtrips, unit=_('queries')) | |
223 | ui.debug("query %i; still undecided: %i, sample size is: %i\n" |
|
223 | ui.debug("query %i; still undecided: %i, sample size is: %i\n" | |
224 | % (roundtrips, len(undecided), len(sample))) |
|
224 | % (roundtrips, len(undecided), len(sample))) | |
225 | # indices between sample and externalized version must match |
|
225 | # indices between sample and externalized version must match | |
226 | sample = list(sample) |
|
226 | sample = list(sample) | |
227 | yesno = remote.known(dag.externalizeall(sample)) |
|
227 | yesno = remote.known(dag.externalizeall(sample)) | |
228 | full = True |
|
228 | full = True | |
229 |
|
229 | |||
230 | if sample: |
|
230 | if sample: | |
231 | commoninsample = set(n for i, n in enumerate(sample) if yesno[i]) |
|
231 | commoninsample = set(n for i, n in enumerate(sample) if yesno[i]) | |
232 | common.addbases(commoninsample) |
|
232 | common.addbases(commoninsample) | |
233 | common.removeancestorsfrom(undecided) |
|
233 | common.removeancestorsfrom(undecided) | |
234 |
|
234 | |||
235 | # heads(common) == heads(common.bases) since common represents common.bases |
|
235 | # heads(common) == heads(common.bases) since common represents common.bases | |
236 | # and all its ancestors |
|
236 | # and all its ancestors | |
237 | result = dag.headsetofconnecteds(common.bases) |
|
237 | result = dag.headsetofconnecteds(common.bases) | |
238 | # common.bases can include nullrev, but our contract requires us to not |
|
238 | # common.bases can include nullrev, but our contract requires us to not | |
239 | # return any heads in that case, so discard that |
|
239 | # return any heads in that case, so discard that | |
240 | result.discard(nullrev) |
|
240 | result.discard(nullrev) | |
241 | elapsed = util.timer() - start |
|
241 | elapsed = util.timer() - start | |
242 | ui.progress(_('searching'), None) |
|
242 | ui.progress(_('searching'), None) | |
243 | ui.debug("%d total queries in %.4fs\n" % (roundtrips, elapsed)) |
|
243 | ui.debug("%d total queries in %.4fs\n" % (roundtrips, elapsed)) | |
|
244 | msg = 'found %d common and %d missing heads, %d roundtrips in %.4fs\n' | |||
|
245 | ui.log('discovery', msg, len(result), len(srvheadhashes), roundtrips, | |||
|
246 | elapsed) | |||
244 |
|
247 | |||
245 | if not result and srvheadhashes != [nullid]: |
|
248 | if not result and srvheadhashes != [nullid]: | |
246 | if abortwhenunrelated: |
|
249 | if abortwhenunrelated: | |
247 | raise error.Abort(_("repository is unrelated")) |
|
250 | raise error.Abort(_("repository is unrelated")) | |
248 | else: |
|
251 | else: | |
249 | ui.warn(_("warning: repository is unrelated\n")) |
|
252 | ui.warn(_("warning: repository is unrelated\n")) | |
250 | return ({nullid}, True, srvheadhashes,) |
|
253 | return ({nullid}, True, srvheadhashes,) | |
251 |
|
254 | |||
252 | anyincoming = (srvheadhashes != [nullid]) |
|
255 | anyincoming = (srvheadhashes != [nullid]) | |
253 | return dag.externalizeall(result), anyincoming, srvheadhashes |
|
256 | return dag.externalizeall(result), anyincoming, srvheadhashes |
@@ -1,405 +1,410 b'' | |||||
1 |
|
1 | |||
2 | Function to test discovery between two repos in both directions, using both the local shortcut |
|
2 | Function to test discovery between two repos in both directions, using both the local shortcut | |
3 | (which is currently not activated by default) and the full remotable protocol: |
|
3 | (which is currently not activated by default) and the full remotable protocol: | |
4 |
|
4 | |||
5 | $ testdesc() { # revs_a, revs_b, dagdesc |
|
5 | $ testdesc() { # revs_a, revs_b, dagdesc | |
6 | > if [ -d foo ]; then rm -rf foo; fi |
|
6 | > if [ -d foo ]; then rm -rf foo; fi | |
7 | > hg init foo |
|
7 | > hg init foo | |
8 | > cd foo |
|
8 | > cd foo | |
9 | > hg debugbuilddag "$3" |
|
9 | > hg debugbuilddag "$3" | |
10 | > hg clone . a $1 --quiet |
|
10 | > hg clone . a $1 --quiet | |
11 | > hg clone . b $2 --quiet |
|
11 | > hg clone . b $2 --quiet | |
12 | > echo |
|
12 | > echo | |
13 | > echo "% -- a -> b tree" |
|
13 | > echo "% -- a -> b tree" | |
14 | > hg -R a debugdiscovery b --verbose --old |
|
14 | > hg -R a debugdiscovery b --verbose --old | |
15 | > echo |
|
15 | > echo | |
16 | > echo "% -- a -> b set" |
|
16 | > echo "% -- a -> b set" | |
17 | > hg -R a debugdiscovery b --verbose --debug --config progress.debug=true |
|
17 | > hg -R a debugdiscovery b --verbose --debug --config progress.debug=true | |
18 | > echo |
|
18 | > echo | |
19 | > echo "% -- b -> a tree" |
|
19 | > echo "% -- b -> a tree" | |
20 | > hg -R b debugdiscovery a --verbose --old --config |
|
20 | > hg -R b debugdiscovery a --verbose --old --config | |
21 | > echo |
|
21 | > echo | |
22 | > echo "% -- b -> a set" |
|
22 | > echo "% -- b -> a set" | |
23 | > hg -R b debugdiscovery a --verbose --debug --config progress.debug=true |
|
23 | > hg -R b debugdiscovery a --verbose --debug --config progress.debug=true | |
24 | > cd .. |
|
24 | > cd .. | |
25 | > } |
|
25 | > } | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | Small superset: |
|
28 | Small superset: | |
29 |
|
29 | |||
30 | $ testdesc '-ra1 -ra2' '-rb1 -rb2 -rb3' ' |
|
30 | $ testdesc '-ra1 -ra2' '-rb1 -rb2 -rb3' ' | |
31 | > +2:f +1:a1:b1 |
|
31 | > +2:f +1:a1:b1 | |
32 | > <f +4 :a2 |
|
32 | > <f +4 :a2 | |
33 | > +5 :b2 |
|
33 | > +5 :b2 | |
34 | > <f +3 :b3' |
|
34 | > <f +3 :b3' | |
35 |
|
35 | |||
36 | % -- a -> b tree |
|
36 | % -- a -> b tree | |
37 | comparing with b |
|
37 | comparing with b | |
38 | searching for changes |
|
38 | searching for changes | |
39 | unpruned common: 01241442b3c2 66f7d451a68b b5714e113bc0 |
|
39 | unpruned common: 01241442b3c2 66f7d451a68b b5714e113bc0 | |
40 | common heads: 01241442b3c2 b5714e113bc0 |
|
40 | common heads: 01241442b3c2 b5714e113bc0 | |
41 | local is subset |
|
41 | local is subset | |
42 |
|
42 | |||
43 | % -- a -> b set |
|
43 | % -- a -> b set | |
44 | comparing with b |
|
44 | comparing with b | |
45 | query 1; heads |
|
45 | query 1; heads | |
46 | searching for changes |
|
46 | searching for changes | |
47 | all local heads known remotely |
|
47 | all local heads known remotely | |
48 | common heads: 01241442b3c2 b5714e113bc0 |
|
48 | common heads: 01241442b3c2 b5714e113bc0 | |
49 | local is subset |
|
49 | local is subset | |
50 |
|
50 | |||
51 | % -- b -> a tree |
|
51 | % -- b -> a tree | |
52 | comparing with a |
|
52 | comparing with a | |
53 | searching for changes |
|
53 | searching for changes | |
54 | unpruned common: 01241442b3c2 b5714e113bc0 |
|
54 | unpruned common: 01241442b3c2 b5714e113bc0 | |
55 | common heads: 01241442b3c2 b5714e113bc0 |
|
55 | common heads: 01241442b3c2 b5714e113bc0 | |
56 | remote is subset |
|
56 | remote is subset | |
57 |
|
57 | |||
58 | % -- b -> a set |
|
58 | % -- b -> a set | |
59 | comparing with a |
|
59 | comparing with a | |
60 | query 1; heads |
|
60 | query 1; heads | |
61 | searching for changes |
|
61 | searching for changes | |
62 | all remote heads known locally |
|
62 | all remote heads known locally | |
63 | common heads: 01241442b3c2 b5714e113bc0 |
|
63 | common heads: 01241442b3c2 b5714e113bc0 | |
64 | remote is subset |
|
64 | remote is subset | |
65 |
|
65 | |||
66 |
|
66 | |||
67 | Many new: |
|
67 | Many new: | |
68 |
|
68 | |||
69 | $ testdesc '-ra1 -ra2' '-rb' ' |
|
69 | $ testdesc '-ra1 -ra2' '-rb' ' | |
70 | > +2:f +3:a1 +3:b |
|
70 | > +2:f +3:a1 +3:b | |
71 | > <f +30 :a2' |
|
71 | > <f +30 :a2' | |
72 |
|
72 | |||
73 | % -- a -> b tree |
|
73 | % -- a -> b tree | |
74 | comparing with b |
|
74 | comparing with b | |
75 | searching for changes |
|
75 | searching for changes | |
76 | unpruned common: bebd167eb94d |
|
76 | unpruned common: bebd167eb94d | |
77 | common heads: bebd167eb94d |
|
77 | common heads: bebd167eb94d | |
78 |
|
78 | |||
79 | % -- a -> b set |
|
79 | % -- a -> b set | |
80 | comparing with b |
|
80 | comparing with b | |
81 | query 1; heads |
|
81 | query 1; heads | |
82 | searching for changes |
|
82 | searching for changes | |
83 | taking initial sample |
|
83 | taking initial sample | |
84 | searching: 2 queries |
|
84 | searching: 2 queries | |
85 | query 2; still undecided: 29, sample size is: 29 |
|
85 | query 2; still undecided: 29, sample size is: 29 | |
86 | 2 total queries in *.????s (glob) |
|
86 | 2 total queries in *.????s (glob) | |
87 | common heads: bebd167eb94d |
|
87 | common heads: bebd167eb94d | |
88 |
|
88 | |||
89 | % -- b -> a tree |
|
89 | % -- b -> a tree | |
90 | comparing with a |
|
90 | comparing with a | |
91 | searching for changes |
|
91 | searching for changes | |
92 | unpruned common: 66f7d451a68b bebd167eb94d |
|
92 | unpruned common: 66f7d451a68b bebd167eb94d | |
93 | common heads: bebd167eb94d |
|
93 | common heads: bebd167eb94d | |
94 |
|
94 | |||
95 | % -- b -> a set |
|
95 | % -- b -> a set | |
96 | comparing with a |
|
96 | comparing with a | |
97 | query 1; heads |
|
97 | query 1; heads | |
98 | searching for changes |
|
98 | searching for changes | |
99 | taking initial sample |
|
99 | taking initial sample | |
100 | searching: 2 queries |
|
100 | searching: 2 queries | |
101 | query 2; still undecided: 2, sample size is: 2 |
|
101 | query 2; still undecided: 2, sample size is: 2 | |
102 | 2 total queries in *.????s (glob) |
|
102 | 2 total queries in *.????s (glob) | |
103 | common heads: bebd167eb94d |
|
103 | common heads: bebd167eb94d | |
104 |
|
104 | |||
105 | Both sides many new with stub: |
|
105 | Both sides many new with stub: | |
106 |
|
106 | |||
107 | $ testdesc '-ra1 -ra2' '-rb' ' |
|
107 | $ testdesc '-ra1 -ra2' '-rb' ' | |
108 | > +2:f +2:a1 +30 :b |
|
108 | > +2:f +2:a1 +30 :b | |
109 | > <f +30 :a2' |
|
109 | > <f +30 :a2' | |
110 |
|
110 | |||
111 | % -- a -> b tree |
|
111 | % -- a -> b tree | |
112 | comparing with b |
|
112 | comparing with b | |
113 | searching for changes |
|
113 | searching for changes | |
114 | unpruned common: 2dc09a01254d |
|
114 | unpruned common: 2dc09a01254d | |
115 | common heads: 2dc09a01254d |
|
115 | common heads: 2dc09a01254d | |
116 |
|
116 | |||
117 | % -- a -> b set |
|
117 | % -- a -> b set | |
118 | comparing with b |
|
118 | comparing with b | |
119 | query 1; heads |
|
119 | query 1; heads | |
120 | searching for changes |
|
120 | searching for changes | |
121 | taking initial sample |
|
121 | taking initial sample | |
122 | searching: 2 queries |
|
122 | searching: 2 queries | |
123 | query 2; still undecided: 29, sample size is: 29 |
|
123 | query 2; still undecided: 29, sample size is: 29 | |
124 | 2 total queries in *.????s (glob) |
|
124 | 2 total queries in *.????s (glob) | |
125 | common heads: 2dc09a01254d |
|
125 | common heads: 2dc09a01254d | |
126 |
|
126 | |||
127 | % -- b -> a tree |
|
127 | % -- b -> a tree | |
128 | comparing with a |
|
128 | comparing with a | |
129 | searching for changes |
|
129 | searching for changes | |
130 | unpruned common: 2dc09a01254d 66f7d451a68b |
|
130 | unpruned common: 2dc09a01254d 66f7d451a68b | |
131 | common heads: 2dc09a01254d |
|
131 | common heads: 2dc09a01254d | |
132 |
|
132 | |||
133 | % -- b -> a set |
|
133 | % -- b -> a set | |
134 | comparing with a |
|
134 | comparing with a | |
135 | query 1; heads |
|
135 | query 1; heads | |
136 | searching for changes |
|
136 | searching for changes | |
137 | taking initial sample |
|
137 | taking initial sample | |
138 | searching: 2 queries |
|
138 | searching: 2 queries | |
139 | query 2; still undecided: 29, sample size is: 29 |
|
139 | query 2; still undecided: 29, sample size is: 29 | |
140 | 2 total queries in *.????s (glob) |
|
140 | 2 total queries in *.????s (glob) | |
141 | common heads: 2dc09a01254d |
|
141 | common heads: 2dc09a01254d | |
142 |
|
142 | |||
143 |
|
143 | |||
144 | Both many new: |
|
144 | Both many new: | |
145 |
|
145 | |||
146 | $ testdesc '-ra' '-rb' ' |
|
146 | $ testdesc '-ra' '-rb' ' | |
147 | > +2:f +30 :b |
|
147 | > +2:f +30 :b | |
148 | > <f +30 :a' |
|
148 | > <f +30 :a' | |
149 |
|
149 | |||
150 | % -- a -> b tree |
|
150 | % -- a -> b tree | |
151 | comparing with b |
|
151 | comparing with b | |
152 | searching for changes |
|
152 | searching for changes | |
153 | unpruned common: 66f7d451a68b |
|
153 | unpruned common: 66f7d451a68b | |
154 | common heads: 66f7d451a68b |
|
154 | common heads: 66f7d451a68b | |
155 |
|
155 | |||
156 | % -- a -> b set |
|
156 | % -- a -> b set | |
157 | comparing with b |
|
157 | comparing with b | |
158 | query 1; heads |
|
158 | query 1; heads | |
159 | searching for changes |
|
159 | searching for changes | |
160 | taking quick initial sample |
|
160 | taking quick initial sample | |
161 | searching: 2 queries |
|
161 | searching: 2 queries | |
162 | query 2; still undecided: 31, sample size is: 31 |
|
162 | query 2; still undecided: 31, sample size is: 31 | |
163 | 2 total queries in *.????s (glob) |
|
163 | 2 total queries in *.????s (glob) | |
164 | common heads: 66f7d451a68b |
|
164 | common heads: 66f7d451a68b | |
165 |
|
165 | |||
166 | % -- b -> a tree |
|
166 | % -- b -> a tree | |
167 | comparing with a |
|
167 | comparing with a | |
168 | searching for changes |
|
168 | searching for changes | |
169 | unpruned common: 66f7d451a68b |
|
169 | unpruned common: 66f7d451a68b | |
170 | common heads: 66f7d451a68b |
|
170 | common heads: 66f7d451a68b | |
171 |
|
171 | |||
172 | % -- b -> a set |
|
172 | % -- b -> a set | |
173 | comparing with a |
|
173 | comparing with a | |
174 | query 1; heads |
|
174 | query 1; heads | |
175 | searching for changes |
|
175 | searching for changes | |
176 | taking quick initial sample |
|
176 | taking quick initial sample | |
177 | searching: 2 queries |
|
177 | searching: 2 queries | |
178 | query 2; still undecided: 31, sample size is: 31 |
|
178 | query 2; still undecided: 31, sample size is: 31 | |
179 | 2 total queries in *.????s (glob) |
|
179 | 2 total queries in *.????s (glob) | |
180 | common heads: 66f7d451a68b |
|
180 | common heads: 66f7d451a68b | |
181 |
|
181 | |||
182 |
|
182 | |||
183 | Both many new skewed: |
|
183 | Both many new skewed: | |
184 |
|
184 | |||
185 | $ testdesc '-ra' '-rb' ' |
|
185 | $ testdesc '-ra' '-rb' ' | |
186 | > +2:f +30 :b |
|
186 | > +2:f +30 :b | |
187 | > <f +50 :a' |
|
187 | > <f +50 :a' | |
188 |
|
188 | |||
189 | % -- a -> b tree |
|
189 | % -- a -> b tree | |
190 | comparing with b |
|
190 | comparing with b | |
191 | searching for changes |
|
191 | searching for changes | |
192 | unpruned common: 66f7d451a68b |
|
192 | unpruned common: 66f7d451a68b | |
193 | common heads: 66f7d451a68b |
|
193 | common heads: 66f7d451a68b | |
194 |
|
194 | |||
195 | % -- a -> b set |
|
195 | % -- a -> b set | |
196 | comparing with b |
|
196 | comparing with b | |
197 | query 1; heads |
|
197 | query 1; heads | |
198 | searching for changes |
|
198 | searching for changes | |
199 | taking quick initial sample |
|
199 | taking quick initial sample | |
200 | searching: 2 queries |
|
200 | searching: 2 queries | |
201 | query 2; still undecided: 51, sample size is: 51 |
|
201 | query 2; still undecided: 51, sample size is: 51 | |
202 | 2 total queries in *.????s (glob) |
|
202 | 2 total queries in *.????s (glob) | |
203 | common heads: 66f7d451a68b |
|
203 | common heads: 66f7d451a68b | |
204 |
|
204 | |||
205 | % -- b -> a tree |
|
205 | % -- b -> a tree | |
206 | comparing with a |
|
206 | comparing with a | |
207 | searching for changes |
|
207 | searching for changes | |
208 | unpruned common: 66f7d451a68b |
|
208 | unpruned common: 66f7d451a68b | |
209 | common heads: 66f7d451a68b |
|
209 | common heads: 66f7d451a68b | |
210 |
|
210 | |||
211 | % -- b -> a set |
|
211 | % -- b -> a set | |
212 | comparing with a |
|
212 | comparing with a | |
213 | query 1; heads |
|
213 | query 1; heads | |
214 | searching for changes |
|
214 | searching for changes | |
215 | taking quick initial sample |
|
215 | taking quick initial sample | |
216 | searching: 2 queries |
|
216 | searching: 2 queries | |
217 | query 2; still undecided: 31, sample size is: 31 |
|
217 | query 2; still undecided: 31, sample size is: 31 | |
218 | 2 total queries in *.????s (glob) |
|
218 | 2 total queries in *.????s (glob) | |
219 | common heads: 66f7d451a68b |
|
219 | common heads: 66f7d451a68b | |
220 |
|
220 | |||
221 |
|
221 | |||
222 | Both many new on top of long history: |
|
222 | Both many new on top of long history: | |
223 |
|
223 | |||
224 | $ testdesc '-ra' '-rb' ' |
|
224 | $ testdesc '-ra' '-rb' ' | |
225 | > +1000:f +30 :b |
|
225 | > +1000:f +30 :b | |
226 | > <f +50 :a' |
|
226 | > <f +50 :a' | |
227 |
|
227 | |||
228 | % -- a -> b tree |
|
228 | % -- a -> b tree | |
229 | comparing with b |
|
229 | comparing with b | |
230 | searching for changes |
|
230 | searching for changes | |
231 | unpruned common: 7ead0cba2838 |
|
231 | unpruned common: 7ead0cba2838 | |
232 | common heads: 7ead0cba2838 |
|
232 | common heads: 7ead0cba2838 | |
233 |
|
233 | |||
234 | % -- a -> b set |
|
234 | % -- a -> b set | |
235 | comparing with b |
|
235 | comparing with b | |
236 | query 1; heads |
|
236 | query 1; heads | |
237 | searching for changes |
|
237 | searching for changes | |
238 | taking quick initial sample |
|
238 | taking quick initial sample | |
239 | searching: 2 queries |
|
239 | searching: 2 queries | |
240 | query 2; still undecided: 1049, sample size is: 11 |
|
240 | query 2; still undecided: 1049, sample size is: 11 | |
241 | sampling from both directions |
|
241 | sampling from both directions | |
242 | searching: 3 queries |
|
242 | searching: 3 queries | |
243 | query 3; still undecided: 31, sample size is: 31 |
|
243 | query 3; still undecided: 31, sample size is: 31 | |
244 | 3 total queries in *.????s (glob) |
|
244 | 3 total queries in *.????s (glob) | |
245 | common heads: 7ead0cba2838 |
|
245 | common heads: 7ead0cba2838 | |
246 |
|
246 | |||
247 | % -- b -> a tree |
|
247 | % -- b -> a tree | |
248 | comparing with a |
|
248 | comparing with a | |
249 | searching for changes |
|
249 | searching for changes | |
250 | unpruned common: 7ead0cba2838 |
|
250 | unpruned common: 7ead0cba2838 | |
251 | common heads: 7ead0cba2838 |
|
251 | common heads: 7ead0cba2838 | |
252 |
|
252 | |||
253 | % -- b -> a set |
|
253 | % -- b -> a set | |
254 | comparing with a |
|
254 | comparing with a | |
255 | query 1; heads |
|
255 | query 1; heads | |
256 | searching for changes |
|
256 | searching for changes | |
257 | taking quick initial sample |
|
257 | taking quick initial sample | |
258 | searching: 2 queries |
|
258 | searching: 2 queries | |
259 | query 2; still undecided: 1029, sample size is: 11 |
|
259 | query 2; still undecided: 1029, sample size is: 11 | |
260 | sampling from both directions |
|
260 | sampling from both directions | |
261 | searching: 3 queries |
|
261 | searching: 3 queries | |
262 | query 3; still undecided: 15, sample size is: 15 |
|
262 | query 3; still undecided: 15, sample size is: 15 | |
263 | 3 total queries in *.????s (glob) |
|
263 | 3 total queries in *.????s (glob) | |
264 | common heads: 7ead0cba2838 |
|
264 | common heads: 7ead0cba2838 | |
265 |
|
265 | |||
266 |
|
266 | |||
267 | One with >200 heads, which used to use up all of the sample: |
|
267 | One with >200 heads, which used to use up all of the sample: | |
268 |
|
268 | |||
269 | $ hg init manyheads |
|
269 | $ hg init manyheads | |
270 | $ cd manyheads |
|
270 | $ cd manyheads | |
271 | $ echo "+300:r @a" >dagdesc |
|
271 | $ echo "+300:r @a" >dagdesc | |
272 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
272 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
273 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
273 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
274 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
274 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
275 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
275 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
276 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
276 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
277 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
277 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
278 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
278 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
279 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
279 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
280 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
280 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
281 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
281 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
282 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
282 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
283 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
283 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
284 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads |
|
284 | $ echo "*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3 *r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3*r+3" >>dagdesc # 20 heads | |
285 | $ echo "@b *r+3" >>dagdesc # one more head |
|
285 | $ echo "@b *r+3" >>dagdesc # one more head | |
286 | $ hg debugbuilddag <dagdesc |
|
286 | $ hg debugbuilddag <dagdesc | |
287 | reading DAG from stdin |
|
287 | reading DAG from stdin | |
288 |
|
288 | |||
289 | $ hg heads -t --template . | wc -c |
|
289 | $ hg heads -t --template . | wc -c | |
290 | \s*261 (re) |
|
290 | \s*261 (re) | |
291 |
|
291 | |||
292 | $ hg clone -b a . a |
|
292 | $ hg clone -b a . a | |
293 | adding changesets |
|
293 | adding changesets | |
294 | adding manifests |
|
294 | adding manifests | |
295 | adding file changes |
|
295 | adding file changes | |
296 | added 1340 changesets with 0 changes to 0 files (+259 heads) |
|
296 | added 1340 changesets with 0 changes to 0 files (+259 heads) | |
297 | updating to branch a |
|
297 | updating to branch a | |
298 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
298 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
299 | $ hg clone -b b . b |
|
299 | $ hg clone -b b . b | |
300 | adding changesets |
|
300 | adding changesets | |
301 | adding manifests |
|
301 | adding manifests | |
302 | adding file changes |
|
302 | adding file changes | |
303 | added 304 changesets with 0 changes to 0 files |
|
303 | added 304 changesets with 0 changes to 0 files | |
304 | updating to branch b |
|
304 | updating to branch b | |
305 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
305 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
306 |
|
306 | |||
307 | $ hg -R a debugdiscovery b --debug --verbose --config progress.debug=true |
|
307 | $ hg -R a debugdiscovery b --debug --verbose --config progress.debug=true | |
308 | comparing with b |
|
308 | comparing with b | |
309 | query 1; heads |
|
309 | query 1; heads | |
310 | searching for changes |
|
310 | searching for changes | |
311 | taking quick initial sample |
|
311 | taking quick initial sample | |
312 | searching: 2 queries |
|
312 | searching: 2 queries | |
313 | query 2; still undecided: 1240, sample size is: 100 |
|
313 | query 2; still undecided: 1240, sample size is: 100 | |
314 | sampling from both directions |
|
314 | sampling from both directions | |
315 | searching: 3 queries |
|
315 | searching: 3 queries | |
316 | query 3; still undecided: 1140, sample size is: 200 |
|
316 | query 3; still undecided: 1140, sample size is: 200 | |
317 | sampling from both directions |
|
317 | sampling from both directions | |
318 | searching: 4 queries |
|
318 | searching: 4 queries | |
319 | query 4; still undecided: \d+, sample size is: 200 (re) |
|
319 | query 4; still undecided: \d+, sample size is: 200 (re) | |
320 | sampling from both directions |
|
320 | sampling from both directions | |
321 | searching: 5 queries |
|
321 | searching: 5 queries | |
322 | query 5; still undecided: \d+, sample size is: 200 (re) |
|
322 | query 5; still undecided: \d+, sample size is: 200 (re) | |
323 | sampling from both directions |
|
323 | sampling from both directions | |
324 | searching: 6 queries |
|
324 | searching: 6 queries | |
325 | query 6; still undecided: \d+, sample size is: \d+ (re) |
|
325 | query 6; still undecided: \d+, sample size is: \d+ (re) | |
326 | 6 total queries in *.????s (glob) |
|
326 | 6 total queries in *.????s (glob) | |
327 | common heads: 3ee37d65064a |
|
327 | common heads: 3ee37d65064a | |
328 |
|
328 | |||
329 | Test actual protocol when pulling one new head in addition to common heads |
|
329 | Test actual protocol when pulling one new head in addition to common heads | |
330 |
|
330 | |||
331 | $ hg clone -U b c |
|
331 | $ hg clone -U b c | |
332 | $ hg -R c id -ir tip |
|
332 | $ hg -R c id -ir tip | |
333 | 513314ca8b3a |
|
333 | 513314ca8b3a | |
334 | $ hg -R c up -qr default |
|
334 | $ hg -R c up -qr default | |
335 | $ touch c/f |
|
335 | $ touch c/f | |
336 | $ hg -R c ci -Aqm "extra head" |
|
336 | $ hg -R c ci -Aqm "extra head" | |
337 | $ hg -R c id -i |
|
337 | $ hg -R c id -i | |
338 | e64a39e7da8b |
|
338 | e64a39e7da8b | |
339 |
|
339 | |||
340 | $ hg serve -R c -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
340 | $ hg serve -R c -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
341 | $ cat hg.pid >> $DAEMON_PIDS |
|
341 | $ cat hg.pid >> $DAEMON_PIDS | |
342 |
|
342 | |||
343 | $ hg -R b incoming http://localhost:$HGPORT/ -T '{node|short}\n' |
|
343 | $ hg -R b incoming http://localhost:$HGPORT/ -T '{node|short}\n' | |
344 | comparing with http://localhost:$HGPORT/ |
|
344 | comparing with http://localhost:$HGPORT/ | |
345 | searching for changes |
|
345 | searching for changes | |
346 | e64a39e7da8b |
|
346 | e64a39e7da8b | |
347 |
|
347 | |||
348 | $ killdaemons.py |
|
348 | $ killdaemons.py | |
349 | $ cut -d' ' -f6- access.log | grep -v cmd=known # cmd=known uses random sampling |
|
349 | $ cut -d' ' -f6- access.log | grep -v cmd=known # cmd=known uses random sampling | |
350 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
350 | "GET /?cmd=capabilities HTTP/1.1" 200 - | |
351 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
351 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) | |
352 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
352 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) | |
353 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
353 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) | |
354 | $ cat errors.log |
|
354 | $ cat errors.log | |
355 |
|
355 | |||
356 | $ cd .. |
|
356 | $ cd .. | |
357 |
|
357 | |||
358 |
|
358 | |||
359 | Issue 4438 - test coverage for 3ef893520a85 issues. |
|
359 | Issue 4438 - test coverage for 3ef893520a85 issues. | |
360 |
|
360 | |||
361 | $ mkdir issue4438 |
|
361 | $ mkdir issue4438 | |
362 | $ cd issue4438 |
|
362 | $ cd issue4438 | |
363 | #if false |
|
363 | #if false | |
364 | generate new bundles: |
|
364 | generate new bundles: | |
365 | $ hg init r1 |
|
365 | $ hg init r1 | |
366 | $ for i in `python $TESTDIR/seq.py 101`; do hg -R r1 up -qr null && hg -R r1 branch -q b$i && hg -R r1 ci -qmb$i; done |
|
366 | $ for i in `python $TESTDIR/seq.py 101`; do hg -R r1 up -qr null && hg -R r1 branch -q b$i && hg -R r1 ci -qmb$i; done | |
367 | $ hg clone -q r1 r2 |
|
367 | $ hg clone -q r1 r2 | |
368 | $ for i in `python $TESTDIR/seq.py 10`; do hg -R r1 up -qr null && hg -R r1 branch -q c$i && hg -R r1 ci -qmc$i; done |
|
368 | $ for i in `python $TESTDIR/seq.py 10`; do hg -R r1 up -qr null && hg -R r1 branch -q c$i && hg -R r1 ci -qmc$i; done | |
369 | $ hg -R r2 branch -q r2change && hg -R r2 ci -qmr2change |
|
369 | $ hg -R r2 branch -q r2change && hg -R r2 ci -qmr2change | |
370 | $ hg -R r1 bundle -qa $TESTDIR/bundles/issue4438-r1.hg |
|
370 | $ hg -R r1 bundle -qa $TESTDIR/bundles/issue4438-r1.hg | |
371 | $ hg -R r2 bundle -qa $TESTDIR/bundles/issue4438-r2.hg |
|
371 | $ hg -R r2 bundle -qa $TESTDIR/bundles/issue4438-r2.hg | |
372 | #else |
|
372 | #else | |
373 | use existing bundles: |
|
373 | use existing bundles: | |
374 | $ hg clone -q $TESTDIR/bundles/issue4438-r1.hg r1 |
|
374 | $ hg clone -q $TESTDIR/bundles/issue4438-r1.hg r1 | |
375 | $ hg clone -q $TESTDIR/bundles/issue4438-r2.hg r2 |
|
375 | $ hg clone -q $TESTDIR/bundles/issue4438-r2.hg r2 | |
376 | #endif |
|
376 | #endif | |
377 |
|
377 | |||
378 | Set iteration order could cause wrong and unstable results - fixed in 73cfaa348650: |
|
378 | Set iteration order could cause wrong and unstable results - fixed in 73cfaa348650: | |
379 |
|
379 | |||
380 | $ hg -R r1 outgoing r2 -T'{rev} ' |
|
380 | $ hg -R r1 outgoing r2 -T'{rev} ' | |
381 | comparing with r2 |
|
381 | comparing with r2 | |
382 | searching for changes |
|
382 | searching for changes | |
383 | 101 102 103 104 105 106 107 108 109 110 (no-eol) |
|
383 | 101 102 103 104 105 106 107 108 109 110 (no-eol) | |
384 |
|
384 | |||
385 | The case where all the 'initialsamplesize' samples already were common would |
|
385 | The case where all the 'initialsamplesize' samples already were common would | |
386 | give 'all remote heads known locally' without checking the remaining heads - |
|
386 | give 'all remote heads known locally' without checking the remaining heads - | |
387 | fixed in 86c35b7ae300: |
|
387 | fixed in 86c35b7ae300: | |
388 |
|
388 | |||
389 | $ cat >> $TESTTMP/unrandomsample.py << EOF |
|
389 | $ cat >> $TESTTMP/unrandomsample.py << EOF | |
390 | > import random |
|
390 | > import random | |
391 | > def sample(population, k): |
|
391 | > def sample(population, k): | |
392 | > return sorted(population)[:k] |
|
392 | > return sorted(population)[:k] | |
393 | > random.sample = sample |
|
393 | > random.sample = sample | |
394 | > EOF |
|
394 | > EOF | |
395 |
|
395 | |||
396 | $ cat >> r1/.hg/hgrc << EOF |
|
396 | $ cat >> r1/.hg/hgrc << EOF | |
397 | > [extensions] |
|
397 | > [extensions] | |
398 | > unrandomsample = $TESTTMP/unrandomsample.py |
|
398 | > unrandomsample = $TESTTMP/unrandomsample.py | |
399 | > EOF |
|
399 | > EOF | |
400 |
|
400 | |||
401 | $ hg -R r1 outgoing r2 -T'{rev} ' |
|
401 | $ hg -R r1 outgoing r2 -T'{rev} ' --config extensions.blackbox= | |
402 |
|
|
402 | comparing with r2 | |
403 | searching for changes |
|
403 | searching for changes | |
404 | 101 102 103 104 105 106 107 108 109 110 (no-eol) |
|
404 | 101 102 103 104 105 106 107 108 109 110 (no-eol) | |
|
405 | $ hg -R r1 --config extensions.blackbox= blackbox | |||
|
406 | * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> outgoing r2 '-T{rev} ' (glob) | |||
|
407 | * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> found 101 common and 101 missing heads, 2 roundtrips in *.????s (glob) | |||
|
408 | * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> -R r1 outgoing r2 '-T{rev} ' --config 'extensions.blackbox=' exited 0 after *.?? seconds (glob) | |||
|
409 | * @5d0b986a083e0d91f116de4691e2aaa54d5bbec0 (*)> blackbox (glob) | |||
405 | $ cd .. |
|
410 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now