Mercurial > hg
comparison mercurial/obsutil.py @ 33996:98fa777cd7a1
template: better prune support in obsfate
successorssets don't returns good results for pruned commit, add a workaround
for simple cases.
A proper fix would require a large rework of successorssets algorithm, I will
send a separate series for this refactoring.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 03 Jul 2017 17:38:56 +0200 |
parents | c35c0f54f420 |
children | 7cdc8c5a481a |
comparison
equal
deleted
inserted
replaced
33995:c35c0f54f420 | 33996:98fa777cd7a1 |
---|---|
583 if not ctx.obsolete(): | 583 if not ctx.obsolete(): |
584 return None | 584 return None |
585 | 585 |
586 ssets = successorssets(repo, ctx.node(), closest=True) | 586 ssets = successorssets(repo, ctx.node(), closest=True) |
587 | 587 |
588 # closestsuccessors returns an empty list for pruned revisions, remap it | |
589 # into a list containing an empty list for future processing | |
590 if ssets == []: | |
591 ssets = [[]] | |
592 | |
593 # Try to recover pruned markers | |
594 succsmap = repo.obsstore.successors | |
595 fullsuccessorsets = [] # successor set + markers | |
596 for sset in ssets: | |
597 if sset: | |
598 fullsuccessorsets.append(sset) | |
599 else: | |
600 # successorsset return an empty set() when ctx or one of its | |
601 # successors is pruned. | |
602 # In this case, walk the obs-markers tree again starting with ctx | |
603 # and find the relevant pruning obs-makers, the ones without | |
604 # successors. | |
605 # Having these markers allow us to compute some information about | |
606 # its fate, like who pruned this changeset and when. | |
607 | |
608 # XXX we do not catch all prune markers (eg rewritten then pruned) | |
609 # (fix me later) | |
610 foundany = False | |
611 for mark in succsmap.get(ctx.node(), ()): | |
612 if not mark[1]: | |
613 foundany = True | |
614 sset = _succs() | |
615 sset.markers.add(mark) | |
616 fullsuccessorsets.append(sset) | |
617 if not foundany: | |
618 fullsuccessorsets.append(_succs()) | |
619 | |
588 values = [] | 620 values = [] |
589 for sset in ssets: | 621 for sset in fullsuccessorsets: |
590 values.append({'successors': sset, 'markers': sset.markers}) | 622 values.append({'successors': sset, 'markers': sset.markers}) |
591 | 623 |
592 return values | 624 return values |
593 | 625 |
594 def successorsetverb(successorset): | 626 def successorsetverb(successorset): |