Show More
@@ -2067,13 +2067,14 b' def debugsub(ui, repo, rev=None):' | |||
|
2067 | 2067 | ui.write((' revision %s\n') % v[1]) |
|
2068 | 2068 | |
|
2069 | 2069 | @command('debugsuccessorssets', |
|
2070 | [], | |
|
2070 | [('', 'closest', False, _('return closest successors sets only'))], | |
|
2071 | 2071 | _('[REV]')) |
|
2072 | def debugsuccessorssets(ui, repo, *revs): | |
|
2072 | def debugsuccessorssets(ui, repo, *revs, **opts): | |
|
2073 | 2073 | """show set of successors for revision |
|
2074 | 2074 | |
|
2075 | 2075 | A successors set of changeset A is a consistent group of revisions that |
|
2076 |
succeed A. It contains non-obsolete changesets only |
|
|
2076 | succeed A. It contains non-obsolete changesets only unless closests | |
|
2077 | successors set is set. | |
|
2077 | 2078 | |
|
2078 | 2079 | In most cases a changeset A has a single successors set containing a single |
|
2079 | 2080 | successor (changeset A replaced by A'). |
@@ -2111,7 +2112,9 b' def debugsuccessorssets(ui, repo, *revs)' | |||
|
2111 | 2112 | for rev in scmutil.revrange(repo, revs): |
|
2112 | 2113 | ctx = repo[rev] |
|
2113 | 2114 | ui.write('%s\n'% ctx2str(ctx)) |
|
2114 |
for succsset in obsutil.successorssets(repo, ctx.node(), |
|
|
2115 | for succsset in obsutil.successorssets(repo, ctx.node(), | |
|
2116 | closest=opts['closest'], | |
|
2117 | cache=cache): | |
|
2115 | 2118 | if succsset: |
|
2116 | 2119 | ui.write(' ') |
|
2117 | 2120 | ui.write(node2str(succsset[0])) |
@@ -311,12 +311,15 b' def getobsoleted(repo, tr):' | |||
|
311 | 311 | obsoleted.add(rev) |
|
312 | 312 | return obsoleted |
|
313 | 313 | |
|
314 | def successorssets(repo, initialnode, cache=None): | |
|
314 | def successorssets(repo, initialnode, closest=False, cache=None): | |
|
315 | 315 | """Return set of all latest successors of initial nodes |
|
316 | 316 | |
|
317 | 317 | The successors set of a changeset A are the group of revisions that succeed |
|
318 | 318 | A. It succeeds A as a consistent whole, each revision being only a partial |
|
319 |
replacement. |
|
|
319 | replacement. By default, the successors set contains non-obsolete | |
|
320 | changesets only, walking the obsolescence graph until reaching a leaf. If | |
|
321 | 'closest' is set to True, closest successors-sets are return (the | |
|
322 | obsolescence walk stops on known changesets). | |
|
320 | 323 | |
|
321 | 324 | This function returns the full list of successor sets which is why it |
|
322 | 325 | returns a list of tuples and not just a single tuple. Each tuple is a valid |
@@ -342,12 +345,19 b' def successorssets(repo, initialnode, ca' | |||
|
342 | 345 | (pruned: obsoleted without any successors). (Final: successors not affected |
|
343 | 346 | by markers). |
|
344 | 347 | |
|
348 | The 'closest' mode respect the repoview filtering. For example, without | |
|
349 | filter it will stop at the first locally known changeset, with 'visible' | |
|
350 | filter it will stop on visible changesets). | |
|
351 | ||
|
345 | 352 | The optional `cache` parameter is a dictionary that may contains |
|
346 | 353 | precomputed successors sets. It is meant to reuse the computation of a |
|
347 | 354 | previous call to `successorssets` when multiple calls are made at the same |
|
348 | 355 | time. The cache dictionary is updated in place. The caller is responsible |
|
349 | 356 | for its life span. Code that makes multiple calls to `successorssets` |
|
350 | 357 | *should* use this cache mechanism or risk a performance hit. |
|
358 | ||
|
359 | Since results are different depending of the 'closest' most, the same cache | |
|
360 | cannot be reused for both mode. | |
|
351 | 361 | """ |
|
352 | 362 | |
|
353 | 363 | succmarkers = repo.obsstore.successors |
@@ -394,8 +404,10 b' def successorssets(repo, initialnode, ca' | |||
|
394 | 404 | # |
|
395 | 405 | # 1) We already know the successors sets of CURRENT: |
|
396 | 406 | # -> mission accomplished, pop it from the stack. |
|
397 | # 2) Node is not obsolete: | |
|
398 | # -> the node is its own successors sets. Add it to the cache. | |
|
407 | # 2) Stop the walk: | |
|
408 | # default case: Node is not obsolete | |
|
409 | # closest case: Node is known at this repo filter level | |
|
410 | # -> the node is its own successors sets. Add it to the cache. | |
|
399 | 411 | # 3) We do not know successors set of direct successors of CURRENT: |
|
400 | 412 | # -> We add those successors to the stack. |
|
401 | 413 | # 4) We know successors sets of all direct successors of CURRENT: |
@@ -403,13 +415,20 b' def successorssets(repo, initialnode, ca' | |||
|
403 | 415 | # cache. |
|
404 | 416 | # |
|
405 | 417 | current = toproceed[-1] |
|
418 | ||
|
419 | # case 2 condition is a bit hairy because of closest, | |
|
420 | # we compute it on its own | |
|
421 | case2condition = ((current not in succmarkers) | |
|
422 | or (closest and current != initialnode | |
|
423 | and current in repo)) | |
|
424 | ||
|
406 | 425 | if current in cache: |
|
407 | 426 | # case (1): We already know the successors sets |
|
408 | 427 | stackedset.remove(toproceed.pop()) |
|
409 | elif current not in succmarkers: | |
|
410 |
# case (2): |
|
|
428 | elif case2condition: | |
|
429 | # case (2): end of walk. | |
|
411 | 430 | if current in repo: |
|
412 |
# We have a valid |
|
|
431 | # We have a valid successors. | |
|
413 | 432 | cache[current] = [(current,)] |
|
414 | 433 | else: |
|
415 | 434 | # Final obsolete version is unknown locally. |
@@ -284,7 +284,7 b' Show all commands + options' | |||
|
284 | 284 | debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized |
|
285 | 285 | debugsetparents: |
|
286 | 286 | debugsub: rev |
|
287 | debugsuccessorssets: | |
|
287 | debugsuccessorssets: closest | |
|
288 | 288 | debugtemplate: rev, define |
|
289 | 289 | debugupdatecaches: |
|
290 | 290 | debugupgraderepo: optimize, run |
@@ -80,6 +80,23 b' A_1 have two direct and divergent succes' | |||
|
80 | 80 | $ hg log -r 'divergent()' |
|
81 | 81 | 2:82623d38b9ba A_1 |
|
82 | 82 | 3:392fd25390da A_2 |
|
83 | $ hg debugsuccessorssets 'all()' --closest | |
|
84 | d20a80d4def3 | |
|
85 | d20a80d4def3 | |
|
86 | 82623d38b9ba | |
|
87 | 82623d38b9ba | |
|
88 | 392fd25390da | |
|
89 | 392fd25390da | |
|
90 | $ hg debugsuccessorssets 'all()' --closest --hidden | |
|
91 | d20a80d4def3 | |
|
92 | d20a80d4def3 | |
|
93 | 007dc284c1f8 | |
|
94 | 82623d38b9ba | |
|
95 | 392fd25390da | |
|
96 | 82623d38b9ba | |
|
97 | 82623d38b9ba | |
|
98 | 392fd25390da | |
|
99 | 392fd25390da | |
|
83 | 100 | |
|
84 | 101 | check that mercurial refuse to push |
|
85 | 102 | |
@@ -128,6 +145,25 b' indirect divergence with known changeset' | |||
|
128 | 145 | $ hg log -r 'divergent()' |
|
129 | 146 | 2:82623d38b9ba A_1 |
|
130 | 147 | 4:01f36c5a8fda A_3 |
|
148 | $ hg debugsuccessorssets 'all()' --closest | |
|
149 | d20a80d4def3 | |
|
150 | d20a80d4def3 | |
|
151 | 82623d38b9ba | |
|
152 | 82623d38b9ba | |
|
153 | 01f36c5a8fda | |
|
154 | 01f36c5a8fda | |
|
155 | $ hg debugsuccessorssets 'all()' --closest --hidden | |
|
156 | d20a80d4def3 | |
|
157 | d20a80d4def3 | |
|
158 | 007dc284c1f8 | |
|
159 | 82623d38b9ba | |
|
160 | 392fd25390da | |
|
161 | 82623d38b9ba | |
|
162 | 82623d38b9ba | |
|
163 | 392fd25390da | |
|
164 | 392fd25390da | |
|
165 | 01f36c5a8fda | |
|
166 | 01f36c5a8fda | |
|
131 | 167 | $ cd .. |
|
132 | 168 | |
|
133 | 169 | |
@@ -160,6 +196,23 b' indirect divergence with known changeset' | |||
|
160 | 196 | $ hg log -r 'divergent()' |
|
161 | 197 | 2:82623d38b9ba A_1 |
|
162 | 198 | 3:392fd25390da A_2 |
|
199 | $ hg debugsuccessorssets 'all()' --closest | |
|
200 | d20a80d4def3 | |
|
201 | d20a80d4def3 | |
|
202 | 82623d38b9ba | |
|
203 | 82623d38b9ba | |
|
204 | 392fd25390da | |
|
205 | 392fd25390da | |
|
206 | $ hg debugsuccessorssets 'all()' --closest --hidden | |
|
207 | d20a80d4def3 | |
|
208 | d20a80d4def3 | |
|
209 | 007dc284c1f8 | |
|
210 | 82623d38b9ba | |
|
211 | 392fd25390da | |
|
212 | 82623d38b9ba | |
|
213 | 82623d38b9ba | |
|
214 | 392fd25390da | |
|
215 | 392fd25390da | |
|
163 | 216 | $ cd .. |
|
164 | 217 | |
|
165 | 218 | do not take unknown node in account if they are final |
@@ -175,6 +228,10 b' do not take unknown node in account if t' | |||
|
175 | 228 | $ hg debugsuccessorssets --hidden 'desc('A_0')' |
|
176 | 229 | 007dc284c1f8 |
|
177 | 230 | 392fd25390da |
|
231 | $ hg debugsuccessorssets 'desc('A_0')' --closest | |
|
232 | $ hg debugsuccessorssets 'desc('A_0')' --closest --hidden | |
|
233 | 007dc284c1f8 | |
|
234 | 82623d38b9ba | |
|
178 | 235 | |
|
179 | 236 | $ cd .. |
|
180 | 237 | |
@@ -211,6 +268,23 b' divergence that converge again is not di' | |||
|
211 | 268 | 01f36c5a8fda |
|
212 | 269 | 01f36c5a8fda |
|
213 | 270 | $ hg log -r 'divergent()' |
|
271 | $ hg debugsuccessorssets 'all()' --closest | |
|
272 | d20a80d4def3 | |
|
273 | d20a80d4def3 | |
|
274 | 01f36c5a8fda | |
|
275 | 01f36c5a8fda | |
|
276 | $ hg debugsuccessorssets 'all()' --closest --hidden | |
|
277 | d20a80d4def3 | |
|
278 | d20a80d4def3 | |
|
279 | 007dc284c1f8 | |
|
280 | 82623d38b9ba | |
|
281 | 392fd25390da | |
|
282 | 82623d38b9ba | |
|
283 | 82623d38b9ba | |
|
284 | 392fd25390da | |
|
285 | 392fd25390da | |
|
286 | 01f36c5a8fda | |
|
287 | 01f36c5a8fda | |
|
214 | 288 |
$ |
|
215 | 289 | |
|
216 | 290 | split is not divergences |
@@ -237,6 +311,22 b' split is not divergences' | |||
|
237 | 311 | 392fd25390da |
|
238 | 312 | 392fd25390da |
|
239 | 313 | $ hg log -r 'divergent()' |
|
314 | $ hg debugsuccessorssets 'all()' --closest | |
|
315 | d20a80d4def3 | |
|
316 | d20a80d4def3 | |
|
317 | 82623d38b9ba | |
|
318 | 82623d38b9ba | |
|
319 | 392fd25390da | |
|
320 | 392fd25390da | |
|
321 | $ hg debugsuccessorssets 'all()' --closest --hidden | |
|
322 | d20a80d4def3 | |
|
323 | d20a80d4def3 | |
|
324 | 007dc284c1f8 | |
|
325 | 82623d38b9ba 392fd25390da | |
|
326 | 82623d38b9ba | |
|
327 | 82623d38b9ba | |
|
328 | 392fd25390da | |
|
329 | 392fd25390da | |
|
240 | 330 | |
|
241 | 331 | Even when subsequent rewriting happen |
|
242 | 332 | |
@@ -283,6 +373,28 b' Even when subsequent rewriting happen' | |||
|
283 | 373 | e442cfc57690 |
|
284 | 374 | e442cfc57690 |
|
285 | 375 | e442cfc57690 |
|
376 | $ hg debugsuccessorssets 'all()' --closest | |
|
377 | d20a80d4def3 | |
|
378 | d20a80d4def3 | |
|
379 | 01f36c5a8fda | |
|
380 | 01f36c5a8fda | |
|
381 | e442cfc57690 | |
|
382 | e442cfc57690 | |
|
383 | $ hg debugsuccessorssets 'all()' --closest --hidden | |
|
384 | d20a80d4def3 | |
|
385 | d20a80d4def3 | |
|
386 | 007dc284c1f8 | |
|
387 | 82623d38b9ba 392fd25390da | |
|
388 | 82623d38b9ba | |
|
389 | 82623d38b9ba | |
|
390 | 392fd25390da | |
|
391 | 392fd25390da | |
|
392 | 01f36c5a8fda | |
|
393 | 01f36c5a8fda | |
|
394 | 6a411f0d7a0a | |
|
395 | e442cfc57690 | |
|
396 | e442cfc57690 | |
|
397 | e442cfc57690 | |
|
286 | 398 | $ hg log -r 'divergent()' |
|
287 | 399 | |
|
288 | 400 | Check more complex obsolescence graft (with divergence) |
@@ -352,6 +464,40 b' Check more complex obsolescence graft (w' | |||
|
352 | 464 | 14608b260df8 |
|
353 | 465 | bed64f5d2f5a |
|
354 | 466 | bed64f5d2f5a |
|
467 | $ hg debugsuccessorssets 'all()' --closest | |
|
468 | d20a80d4def3 | |
|
469 | d20a80d4def3 | |
|
470 | 01f36c5a8fda | |
|
471 | 01f36c5a8fda | |
|
472 | 7ae126973a96 | |
|
473 | 7ae126973a96 | |
|
474 | 14608b260df8 | |
|
475 | 14608b260df8 | |
|
476 | bed64f5d2f5a | |
|
477 | bed64f5d2f5a | |
|
478 | $ hg debugsuccessorssets 'all()' --closest --hidden | |
|
479 | d20a80d4def3 | |
|
480 | d20a80d4def3 | |
|
481 | 007dc284c1f8 | |
|
482 | 82623d38b9ba 392fd25390da | |
|
483 | 82623d38b9ba | |
|
484 | 82623d38b9ba | |
|
485 | 392fd25390da | |
|
486 | 392fd25390da | |
|
487 | 01f36c5a8fda | |
|
488 | 01f36c5a8fda | |
|
489 | 6a411f0d7a0a | |
|
490 | e442cfc57690 | |
|
491 | e442cfc57690 | |
|
492 | e442cfc57690 | |
|
493 | 3750ebee865d | |
|
494 | 392fd25390da | |
|
495 | 7ae126973a96 | |
|
496 | 7ae126973a96 | |
|
497 | 14608b260df8 | |
|
498 | 14608b260df8 | |
|
499 | bed64f5d2f5a | |
|
500 | bed64f5d2f5a | |
|
355 | 501 | $ hg log -r 'divergent()' |
|
356 | 502 | 4:01f36c5a8fda A_3 |
|
357 | 503 | 8:7ae126973a96 A_7 |
@@ -416,6 +562,38 b' fix the divergence' | |||
|
416 | 562 | a139f71be9da |
|
417 | 563 | a139f71be9da |
|
418 | 564 | a139f71be9da |
|
565 | $ hg debugsuccessorssets 'all()' --closest | |
|
566 | d20a80d4def3 | |
|
567 | d20a80d4def3 | |
|
568 | 01f36c5a8fda | |
|
569 | 01f36c5a8fda | |
|
570 | a139f71be9da | |
|
571 | a139f71be9da | |
|
572 | $ hg debugsuccessorssets 'all()' --closest --hidden | |
|
573 | d20a80d4def3 | |
|
574 | d20a80d4def3 | |
|
575 | 007dc284c1f8 | |
|
576 | 82623d38b9ba 392fd25390da | |
|
577 | 82623d38b9ba | |
|
578 | 82623d38b9ba | |
|
579 | 392fd25390da | |
|
580 | 392fd25390da | |
|
581 | 01f36c5a8fda | |
|
582 | 01f36c5a8fda | |
|
583 | 6a411f0d7a0a | |
|
584 | e442cfc57690 | |
|
585 | e442cfc57690 | |
|
586 | e442cfc57690 | |
|
587 | 3750ebee865d | |
|
588 | 392fd25390da | |
|
589 | 7ae126973a96 | |
|
590 | a139f71be9da | |
|
591 | 14608b260df8 | |
|
592 | a139f71be9da | |
|
593 | bed64f5d2f5a | |
|
594 | a139f71be9da | |
|
595 | a139f71be9da | |
|
596 | a139f71be9da | |
|
419 | 597 | $ hg log -r 'divergent()' |
|
420 | 598 | |
|
421 | 599 | $ cd .. |
@@ -433,5 +611,9 b' successors-set. (report [A,B] not [A] + ' | |||
|
433 | 611 | $ hg debugsuccessorssets --hidden 'desc('A_0')' |
|
434 | 612 | 007dc284c1f8 |
|
435 | 613 | 82623d38b9ba 392fd25390da |
|
614 | $ hg debugsuccessorssets 'desc('A_0')' --closest | |
|
615 | $ hg debugsuccessorssets 'desc('A_0')' --closest --hidden | |
|
616 | 007dc284c1f8 | |
|
617 | 82623d38b9ba 392fd25390da | |
|
436 | 618 | |
|
437 | 619 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now