##// END OF EJS Templates
setdiscover: allow to ignore part of the local graph...
Boris Feld -
r35305:f77121b6 default
parent child Browse files
Show More
@@ -154,8 +154,9 b' class revlogbaseddag(basedag):'
154 154 class revlogdag(revlogbaseddag):
155 155 '''dag interface to a revlog'''
156 156
157 def __init__(self, revlog):
157 def __init__(self, revlog, localsubset=None):
158 158 revlogbaseddag.__init__(self, revlog, set(revlog))
159 self._heads = localsubset
159 160
160 161 def _getheads(self):
161 162 return [r for r in self._revlog.headrevs() if r != nullrev]
@@ -734,6 +734,7 b' def debugstate(ui, repo, **opts):'
734 734 [('', 'old', None, _('use old-style discovery')),
735 735 ('', 'nonheads', None,
736 736 _('use old-style discovery with non-heads included')),
737 ('', 'rev', [], 'restrict discovery to this set of revs'),
737 738 ] + cmdutil.remoteopts,
738 739 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
739 740 def debugdiscovery(ui, repo, remoteurl="default", **opts):
@@ -747,11 +748,8 b' def debugdiscovery(ui, repo, remoteurl="'
747 748 # make sure tests are repeatable
748 749 random.seed(12323)
749 750
750 def doit(localheads, remoteheads, remote=remote):
751 def doit(pushedrevs, remoteheads, remote=remote):
751 752 if opts.get('old'):
752 if localheads:
753 raise error.Abort('cannot use localheads with old style '
754 'discovery')
755 753 if not util.safehasattr(remote, 'branches'):
756 754 # enable in-client legacy support
757 755 remote = localrepo.locallegacypeer(remote.local())
@@ -765,7 +763,12 b' def debugdiscovery(ui, repo, remoteurl="'
765 763 all = dag.ancestorset(dag.internalizeall(common))
766 764 common = dag.externalizeall(dag.headsetofconnecteds(all))
767 765 else:
768 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote)
766 nodes = None
767 if pushedrevs:
768 revs = scmutil.revrange(repo, pushedrevs)
769 nodes = [repo[r].node() for r in revs]
770 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote,
771 ancestorsof=nodes)
769 772 common = set(common)
770 773 rheads = set(hds)
771 774 lheads = set(repo.heads())
@@ -794,7 +797,7 b' def debugdiscovery(ui, repo, remoteurl="'
794 797 else:
795 798 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
796 799 opts.get('remote_head'))
797 localrevs = opts.get('local_head')
800 localrevs = opts.get('rev')
798 801 doit(localrevs, remoterevs)
799 802
800 803 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
@@ -133,7 +133,8 b' def _limitsample(sample, desiredlen):'
133 133 def findcommonheads(ui, local, remote,
134 134 initialsamplesize=100,
135 135 fullsamplesize=200,
136 abortwhenunrelated=True):
136 abortwhenunrelated=True,
137 ancestorsof=None):
137 138 '''Return a tuple (common, anyincoming, remoteheads) used to identify
138 139 missing nodes from or in remote.
139 140 '''
@@ -141,7 +142,11 b' def findcommonheads(ui, local, remote,'
141 142
142 143 roundtrips = 0
143 144 cl = local.changelog
144 dag = dagutil.revlogdag(cl)
145 localsubset = None
146 if ancestorsof is not None:
147 rev = local.changelog.rev
148 localsubset = [rev(n) for n in ancestorsof]
149 dag = dagutil.revlogdag(cl, localsubset=localsubset)
145 150
146 151 # early exit if we know all the specified remote heads already
147 152 ui.debug("query 1; heads\n")
@@ -261,7 +261,7 b' Show all commands + options'
261 261 debugdate: extended
262 262 debugdeltachain: changelog, manifest, dir, template
263 263 debugdirstate: nodates, datesort
264 debugdiscovery: old, nonheads, ssh, remotecmd, insecure
264 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
265 265 debugextensions: template
266 266 debugfileset: rev
267 267 debugfsinfo:
@@ -16,11 +16,17 b' Function to test discovery between two r'
16 16 > echo "% -- a -> b set"
17 17 > hg -R a debugdiscovery b --verbose --debug --config progress.debug=true
18 18 > echo
19 > echo "% -- a -> b set (tip only)"
20 > hg -R a debugdiscovery b --verbose --debug --config progress.debug=true --rev tip
21 > echo
19 22 > echo "% -- b -> a tree"
20 23 > hg -R b debugdiscovery a --verbose --old
21 24 > echo
22 25 > echo "% -- b -> a set"
23 26 > hg -R b debugdiscovery a --verbose --debug --config progress.debug=true
27 > echo
28 > echo "% -- b -> a set (tip only)"
29 > hg -R b debugdiscovery a --verbose --debug --config progress.debug=true --rev tip
24 30 > cd ..
25 31 > }
26 32
@@ -48,6 +54,13 b' Small superset:'
48 54 common heads: 01241442b3c2 b5714e113bc0
49 55 local is subset
50 56
57 % -- a -> b set (tip only)
58 comparing with b
59 query 1; heads
60 searching for changes
61 all local heads known remotely
62 common heads: b5714e113bc0
63
51 64 % -- b -> a tree
52 65 comparing with a
53 66 searching for changes
@@ -62,6 +75,14 b' Small superset:'
62 75 all remote heads known locally
63 76 common heads: 01241442b3c2 b5714e113bc0
64 77 remote is subset
78
79 % -- b -> a set (tip only)
80 comparing with a
81 query 1; heads
82 searching for changes
83 all remote heads known locally
84 common heads: 01241442b3c2 b5714e113bc0
85 remote is subset
65 86
66 87
67 88 Many new:
@@ -86,6 +107,16 b' Many new:'
86 107 2 total queries in *.????s (glob)
87 108 common heads: bebd167eb94d
88 109
110 % -- a -> b set (tip only)
111 comparing with b
112 query 1; heads
113 searching for changes
114 taking quick initial sample
115 searching: 2 queries
116 query 2; still undecided: 31, sample size is: 31
117 2 total queries in *.????s (glob)
118 common heads: 66f7d451a68b
119
89 120 % -- b -> a tree
90 121 comparing with a
91 122 searching for changes
@@ -101,6 +132,16 b' Many new:'
101 132 query 2; still undecided: 2, sample size is: 2
102 133 2 total queries in *.????s (glob)
103 134 common heads: bebd167eb94d
135
136 % -- b -> a set (tip only)
137 comparing with a
138 query 1; heads
139 searching for changes
140 taking initial sample
141 searching: 2 queries
142 query 2; still undecided: 2, sample size is: 2
143 2 total queries in *.????s (glob)
144 common heads: bebd167eb94d
104 145
105 146 Both sides many new with stub:
106 147
@@ -124,6 +165,16 b' Both sides many new with stub:'
124 165 2 total queries in *.????s (glob)
125 166 common heads: 2dc09a01254d
126 167
168 % -- a -> b set (tip only)
169 comparing with b
170 query 1; heads
171 searching for changes
172 taking quick initial sample
173 searching: 2 queries
174 query 2; still undecided: 31, sample size is: 31
175 2 total queries in *.????s (glob)
176 common heads: 66f7d451a68b
177
127 178 % -- b -> a tree
128 179 comparing with a
129 180 searching for changes
@@ -139,6 +190,16 b' Both sides many new with stub:'
139 190 query 2; still undecided: 29, sample size is: 29
140 191 2 total queries in *.????s (glob)
141 192 common heads: 2dc09a01254d
193
194 % -- b -> a set (tip only)
195 comparing with a
196 query 1; heads
197 searching for changes
198 taking initial sample
199 searching: 2 queries
200 query 2; still undecided: 29, sample size is: 29
201 2 total queries in *.????s (glob)
202 common heads: 2dc09a01254d
142 203
143 204
144 205 Both many new:
@@ -163,6 +224,16 b' Both many new:'
163 224 2 total queries in *.????s (glob)
164 225 common heads: 66f7d451a68b
165 226
227 % -- a -> b set (tip only)
228 comparing with b
229 query 1; heads
230 searching for changes
231 taking quick initial sample
232 searching: 2 queries
233 query 2; still undecided: 31, sample size is: 31
234 2 total queries in *.????s (glob)
235 common heads: 66f7d451a68b
236
166 237 % -- b -> a tree
167 238 comparing with a
168 239 searching for changes
@@ -178,6 +249,16 b' Both many new:'
178 249 query 2; still undecided: 31, sample size is: 31
179 250 2 total queries in *.????s (glob)
180 251 common heads: 66f7d451a68b
252
253 % -- b -> a set (tip only)
254 comparing with a
255 query 1; heads
256 searching for changes
257 taking quick initial sample
258 searching: 2 queries
259 query 2; still undecided: 31, sample size is: 31
260 2 total queries in *.????s (glob)
261 common heads: 66f7d451a68b
181 262
182 263
183 264 Both many new skewed:
@@ -202,6 +283,16 b' Both many new skewed:'
202 283 2 total queries in *.????s (glob)
203 284 common heads: 66f7d451a68b
204 285
286 % -- a -> b set (tip only)
287 comparing with b
288 query 1; heads
289 searching for changes
290 taking quick initial sample
291 searching: 2 queries
292 query 2; still undecided: 51, sample size is: 51
293 2 total queries in *.????s (glob)
294 common heads: 66f7d451a68b
295
205 296 % -- b -> a tree
206 297 comparing with a
207 298 searching for changes
@@ -217,6 +308,16 b' Both many new skewed:'
217 308 query 2; still undecided: 31, sample size is: 31
218 309 2 total queries in *.????s (glob)
219 310 common heads: 66f7d451a68b
311
312 % -- b -> a set (tip only)
313 comparing with a
314 query 1; heads
315 searching for changes
316 taking quick initial sample
317 searching: 2 queries
318 query 2; still undecided: 31, sample size is: 31
319 2 total queries in *.????s (glob)
320 common heads: 66f7d451a68b
220 321
221 322
222 323 Both many new on top of long history:
@@ -244,6 +345,19 b' Both many new on top of long history:'
244 345 3 total queries in *.????s (glob)
245 346 common heads: 7ead0cba2838
246 347
348 % -- a -> b set (tip only)
349 comparing with b
350 query 1; heads
351 searching for changes
352 taking quick initial sample
353 searching: 2 queries
354 query 2; still undecided: 1049, sample size is: 11
355 sampling from both directions
356 searching: 3 queries
357 query 3; still undecided: 31, sample size is: 31
358 3 total queries in *.????s (glob)
359 common heads: 7ead0cba2838
360
247 361 % -- b -> a tree
248 362 comparing with a
249 363 searching for changes
@@ -262,6 +376,19 b' Both many new on top of long history:'
262 376 query 3; still undecided: 15, sample size is: 15
263 377 3 total queries in *.????s (glob)
264 378 common heads: 7ead0cba2838
379
380 % -- b -> a set (tip only)
381 comparing with a
382 query 1; heads
383 searching for changes
384 taking quick initial sample
385 searching: 2 queries
386 query 2; still undecided: 1029, sample size is: 11
387 sampling from both directions
388 searching: 3 queries
389 query 3; still undecided: 15, sample size is: 15
390 3 total queries in *.????s (glob)
391 common heads: 7ead0cba2838
265 392
266 393
267 394 One with >200 heads, which used to use up all of the sample:
@@ -327,6 +454,18 b' One with >200 heads, which used to use u'
327 454 query 6; still undecided: \d+, sample size is: \d+ (re)
328 455 6 total queries in *.????s (glob)
329 456 common heads: 3ee37d65064a
457 $ hg -R a debugdiscovery b --debug --verbose --config progress.debug=true --rev tip
458 comparing with b
459 query 1; heads
460 searching for changes
461 taking quick initial sample
462 searching: 2 queries
463 query 2; still undecided: 303, sample size is: 9
464 sampling from both directions
465 searching: 3 queries
466 query 3; still undecided: 3, sample size is: 3
467 3 total queries in *.????s (glob)
468 common heads: 3ee37d65064a
330 469
331 470 Test actual protocol when pulling one new head in addition to common heads
332 471
General Comments 0
You need to be logged in to leave comments. Login now