507 |
507 |
508 |
508 |
509 def successorssets(repo, initialnode, cache=None): |
509 def successorssets(repo, initialnode, cache=None): |
510 """Return all set of successors of initial nodes |
510 """Return all set of successors of initial nodes |
511 |
511 |
512 Successors set of changeset A are a group of revision that succeed A. It |
512 The successors set of a changeset A are a group of revisions that succeed |
513 succeed A as a consistent whole, each revision being only partial |
513 A. It succeeds A as a consistent whole, each revision being only a partial |
514 replacement. Successors set contains non-obsolete changeset only. |
514 replacement. The successors set contains non-obsolete changesets only. |
515 |
515 |
516 In most cases a changeset A have zero (changeset pruned) or a single |
516 This function returns the full list of successor sets which is why it |
517 successors set that contains a single successor (changeset A replaced by |
517 returns a list of tuples and not just a single tuple. Each tuple is a valid |
518 A') |
518 successors set. Not that (A,) may be a valid successors set for changeset A |
519 |
519 (see below). |
520 When changeset is split, it results successors set containing more than |
520 |
521 a single element. Divergent rewriting will result in multiple successors |
521 In most cases, a changeset A will have a single element (e.g. the changeset |
522 sets. |
522 A is replaced by A') in its successors set. Though, it is also common for a |
523 |
523 changeset A to have no elements in its successor set (e.g. the changeset |
524 They are returned as a list of tuples containing all valid successors sets. |
524 has been pruned). Therefore, the returned list of successors sets will be |
525 |
525 [(A',)] or [], respectively. |
526 Final successors unknown locally are considered plain prune (obsoleted |
526 |
527 without successors). |
527 When a changeset A is split into A' and B', however, it will result in a |
528 |
528 successors set containing more than a single element, i.e. [(A',B')]. |
529 The optional `cache` parameter is a dictionary that may contains |
529 Divergent changesets will result in multiple successors sets, i.e. [(A',), |
530 precomputed successors sets. It is meant to reuse the computation of |
530 (A'')]. |
531 previous call to `successorssets` when multiple calls are made at the same |
531 |
532 time. The cache dictionary is updated in place. The caller is responsible |
532 If a changeset A is not obsolete, then it will conceptually have no |
533 for its live spawn. Code that makes multiple calls to `successorssets` |
533 successors set. To distinguish this from a pruned changeset, the successor |
534 *must* use this cache mechanism or suffer terrible performances.""" |
534 set will only contain itself, i.e. [(A,)]. |
|
535 |
|
536 Finally, successors unknown locally are considered to be pruned (obsoleted |
|
537 without any successors). |
|
538 |
|
539 The optional `cache` parameter is a dictionary that may contain precomputed |
|
540 successors sets. It is meant to reuse the computation of a previous call to |
|
541 `successorssets` when multiple calls are made at the same time. The cache |
|
542 dictionary is updated in place. The caller is responsible for its live |
|
543 spawn. Code that makes multiple calls to `successorssets` *must* use this |
|
544 cache mechanism or suffer terrible performances. |
|
545 |
|
546 """ |
535 |
547 |
536 succmarkers = repo.obsstore.successors |
548 succmarkers = repo.obsstore.successors |
537 |
549 |
538 # Stack of nodes we search successors sets for |
550 # Stack of nodes we search successors sets for |
539 toproceed = [initialnode] |
551 toproceed = [initialnode] |