##// END OF EJS Templates
obsolete: closest divergent support...
Boris Feld -
r33274:68f3e819 default
parent child Browse files
Show More
@@ -2067,13 +2067,14 def debugsub(ui, repo, rev=None):
2067 ui.write((' revision %s\n') % v[1])
2067 ui.write((' revision %s\n') % v[1])
2068
2068
2069 @command('debugsuccessorssets',
2069 @command('debugsuccessorssets',
2070 [],
2070 [('', 'closest', False, _('return closest successors sets only'))],
2071 _('[REV]'))
2071 _('[REV]'))
2072 def debugsuccessorssets(ui, repo, *revs):
2072 def debugsuccessorssets(ui, repo, *revs, **opts):
2073 """show set of successors for revision
2073 """show set of successors for revision
2074
2074
2075 A successors set of changeset A is a consistent group of revisions that
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 In most cases a changeset A has a single successors set containing a single
2079 In most cases a changeset A has a single successors set containing a single
2079 successor (changeset A replaced by A').
2080 successor (changeset A replaced by A').
@@ -2111,7 +2112,9 def debugsuccessorssets(ui, repo, *revs)
2111 for rev in scmutil.revrange(repo, revs):
2112 for rev in scmutil.revrange(repo, revs):
2112 ctx = repo[rev]
2113 ctx = repo[rev]
2113 ui.write('%s\n'% ctx2str(ctx))
2114 ui.write('%s\n'% ctx2str(ctx))
2114 for succsset in obsutil.successorssets(repo, ctx.node(), cache=cache):
2115 for succsset in obsutil.successorssets(repo, ctx.node(),
2116 closest=opts['closest'],
2117 cache=cache):
2115 if succsset:
2118 if succsset:
2116 ui.write(' ')
2119 ui.write(' ')
2117 ui.write(node2str(succsset[0]))
2120 ui.write(node2str(succsset[0]))
@@ -311,12 +311,15 def getobsoleted(repo, tr):
311 obsoleted.add(rev)
311 obsoleted.add(rev)
312 return obsoleted
312 return obsoleted
313
313
314 def successorssets(repo, initialnode, cache=None):
314 def successorssets(repo, initialnode, closest=False, cache=None):
315 """Return set of all latest successors of initial nodes
315 """Return set of all latest successors of initial nodes
316
316
317 The successors set of a changeset A are the group of revisions that succeed
317 The successors set of a changeset A are the group of revisions that succeed
318 A. It succeeds A as a consistent whole, each revision being only a partial
318 A. It succeeds A as a consistent whole, each revision being only a partial
319 replacement. The successors set contains non-obsolete changesets only.
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 This function returns the full list of successor sets which is why it
324 This function returns the full list of successor sets which is why it
322 returns a list of tuples and not just a single tuple. Each tuple is a valid
325 returns a list of tuples and not just a single tuple. Each tuple is a valid
@@ -342,12 +345,19 def successorssets(repo, initialnode, ca
342 (pruned: obsoleted without any successors). (Final: successors not affected
345 (pruned: obsoleted without any successors). (Final: successors not affected
343 by markers).
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 The optional `cache` parameter is a dictionary that may contains
352 The optional `cache` parameter is a dictionary that may contains
346 precomputed successors sets. It is meant to reuse the computation of a
353 precomputed successors sets. It is meant to reuse the computation of a
347 previous call to `successorssets` when multiple calls are made at the same
354 previous call to `successorssets` when multiple calls are made at the same
348 time. The cache dictionary is updated in place. The caller is responsible
355 time. The cache dictionary is updated in place. The caller is responsible
349 for its life span. Code that makes multiple calls to `successorssets`
356 for its life span. Code that makes multiple calls to `successorssets`
350 *should* use this cache mechanism or risk a performance hit.
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 succmarkers = repo.obsstore.successors
363 succmarkers = repo.obsstore.successors
@@ -394,7 +404,9 def successorssets(repo, initialnode, ca
394 #
404 #
395 # 1) We already know the successors sets of CURRENT:
405 # 1) We already know the successors sets of CURRENT:
396 # -> mission accomplished, pop it from the stack.
406 # -> mission accomplished, pop it from the stack.
397 # 2) Node is not obsolete:
407 # 2) Stop the walk:
408 # default case: Node is not obsolete
409 # closest case: Node is known at this repo filter level
398 # -> the node is its own successors sets. Add it to the cache.
410 # -> the node is its own successors sets. Add it to the cache.
399 # 3) We do not know successors set of direct successors of CURRENT:
411 # 3) We do not know successors set of direct successors of CURRENT:
400 # -> We add those successors to the stack.
412 # -> We add those successors to the stack.
@@ -403,13 +415,20 def successorssets(repo, initialnode, ca
403 # cache.
415 # cache.
404 #
416 #
405 current = toproceed[-1]
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 if current in cache:
425 if current in cache:
407 # case (1): We already know the successors sets
426 # case (1): We already know the successors sets
408 stackedset.remove(toproceed.pop())
427 stackedset.remove(toproceed.pop())
409 elif current not in succmarkers:
428 elif case2condition:
410 # case (2): The node is not obsolete.
429 # case (2): end of walk.
411 if current in repo:
430 if current in repo:
412 # We have a valid last successors.
431 # We have a valid successors.
413 cache[current] = [(current,)]
432 cache[current] = [(current,)]
414 else:
433 else:
415 # Final obsolete version is unknown locally.
434 # Final obsolete version is unknown locally.
@@ -284,7 +284,7 Show all commands + options
284 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
284 debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized
285 debugsetparents:
285 debugsetparents:
286 debugsub: rev
286 debugsub: rev
287 debugsuccessorssets:
287 debugsuccessorssets: closest
288 debugtemplate: rev, define
288 debugtemplate: rev, define
289 debugupdatecaches:
289 debugupdatecaches:
290 debugupgraderepo: optimize, run
290 debugupgraderepo: optimize, run
@@ -80,6 +80,23 A_1 have two direct and divergent succes
80 $ hg log -r 'divergent()'
80 $ hg log -r 'divergent()'
81 2:82623d38b9ba A_1
81 2:82623d38b9ba A_1
82 3:392fd25390da A_2
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 check that mercurial refuse to push
101 check that mercurial refuse to push
85
102
@@ -128,6 +145,25 indirect divergence with known changeset
128 $ hg log -r 'divergent()'
145 $ hg log -r 'divergent()'
129 2:82623d38b9ba A_1
146 2:82623d38b9ba A_1
130 4:01f36c5a8fda A_3
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 $ cd ..
167 $ cd ..
132
168
133
169
@@ -160,6 +196,23 indirect divergence with known changeset
160 $ hg log -r 'divergent()'
196 $ hg log -r 'divergent()'
161 2:82623d38b9ba A_1
197 2:82623d38b9ba A_1
162 3:392fd25390da A_2
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 $ cd ..
216 $ cd ..
164
217
165 do not take unknown node in account if they are final
218 do not take unknown node in account if they are final
@@ -175,6 +228,10 do not take unknown node in account if t
175 $ hg debugsuccessorssets --hidden 'desc('A_0')'
228 $ hg debugsuccessorssets --hidden 'desc('A_0')'
176 007dc284c1f8
229 007dc284c1f8
177 392fd25390da
230 392fd25390da
231 $ hg debugsuccessorssets 'desc('A_0')' --closest
232 $ hg debugsuccessorssets 'desc('A_0')' --closest --hidden
233 007dc284c1f8
234 82623d38b9ba
178
235
179 $ cd ..
236 $ cd ..
180
237
@@ -211,6 +268,23 divergence that converge again is not di
211 01f36c5a8fda
268 01f36c5a8fda
212 01f36c5a8fda
269 01f36c5a8fda
213 $ hg log -r 'divergent()'
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 $ cd ..
288 $ cd ..
215
289
216 split is not divergences
290 split is not divergences
@@ -237,6 +311,22 split is not divergences
237 392fd25390da
311 392fd25390da
238 392fd25390da
312 392fd25390da
239 $ hg log -r 'divergent()'
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 Even when subsequent rewriting happen
331 Even when subsequent rewriting happen
242
332
@@ -283,6 +373,28 Even when subsequent rewriting happen
283 e442cfc57690
373 e442cfc57690
284 e442cfc57690
374 e442cfc57690
285 e442cfc57690
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 $ hg log -r 'divergent()'
398 $ hg log -r 'divergent()'
287
399
288 Check more complex obsolescence graft (with divergence)
400 Check more complex obsolescence graft (with divergence)
@@ -352,6 +464,40 Check more complex obsolescence graft (w
352 14608b260df8
464 14608b260df8
353 bed64f5d2f5a
465 bed64f5d2f5a
354 bed64f5d2f5a
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 $ hg log -r 'divergent()'
501 $ hg log -r 'divergent()'
356 4:01f36c5a8fda A_3
502 4:01f36c5a8fda A_3
357 8:7ae126973a96 A_7
503 8:7ae126973a96 A_7
@@ -416,6 +562,38 fix the divergence
416 a139f71be9da
562 a139f71be9da
417 a139f71be9da
563 a139f71be9da
418 a139f71be9da
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 $ hg log -r 'divergent()'
597 $ hg log -r 'divergent()'
420
598
421 $ cd ..
599 $ cd ..
@@ -433,5 +611,9 successors-set. (report [A,B] not [A] +
433 $ hg debugsuccessorssets --hidden 'desc('A_0')'
611 $ hg debugsuccessorssets --hidden 'desc('A_0')'
434 007dc284c1f8
612 007dc284c1f8
435 82623d38b9ba 392fd25390da
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 $ cd ..
619 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now