Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/obsutil.py @ 43426:e513e87b0476 stable
py3: fix sorting of obsolete markers in obsutil (issue6217)
This is similar to 01e8eefd9434 and others. We move the sortedmarkers()
function from exchange module to obsutil.
author | Denis Laxalde <denis@laxalde.org> |
---|---|
date | Sat, 09 Nov 2019 10:31:58 +0100 |
parents | 8ff1ecfadcd1 |
children | 32048206e7be |
comparison
equal
deleted
inserted
replaced
43425:be0f77fd274d | 43426:e513e87b0476 |
---|---|
108 else: | 108 else: |
109 rawmarkers = repo.obsstore.relevantmarkers(nodes) | 109 rawmarkers = repo.obsstore.relevantmarkers(nodes) |
110 | 110 |
111 for markerdata in rawmarkers: | 111 for markerdata in rawmarkers: |
112 yield marker(repo, markerdata) | 112 yield marker(repo, markerdata) |
113 | |
114 | |
115 def sortedmarkers(markers): | |
116 # last item of marker tuple ('parents') may be None or a tuple | |
117 return sorted(markers, key=lambda m: m[:-1] + (m[-1] or (),)) | |
113 | 118 |
114 | 119 |
115 def closestpredecessors(repo, nodeid): | 120 def closestpredecessors(repo, nodeid): |
116 """yield the list of next predecessors pointing on visible changectx nodes | 121 """yield the list of next predecessors pointing on visible changectx nodes |
117 | 122 |
673 # - The second one handles successors defined in each marker. | 678 # - The second one handles successors defined in each marker. |
674 # | 679 # |
675 # Having none means pruned node, multiple successors means split, | 680 # Having none means pruned node, multiple successors means split, |
676 # single successors are standard replacement. | 681 # single successors are standard replacement. |
677 # | 682 # |
678 for mark in sorted(succmarkers[current]): | 683 for mark in sortedmarkers(succmarkers[current]): |
679 for suc in mark[1]: | 684 for suc in mark[1]: |
680 if suc not in cache: | 685 if suc not in cache: |
681 if suc in stackedset: | 686 if suc in stackedset: |
682 # cycle breaking | 687 # cycle breaking |
683 cache[suc] = [] | 688 cache[suc] = [] |
710 # | 715 # |
711 # At the end we post-process successors sets to remove | 716 # At the end we post-process successors sets to remove |
712 # duplicated entry and successors set that are strict subset of | 717 # duplicated entry and successors set that are strict subset of |
713 # another one. | 718 # another one. |
714 succssets = [] | 719 succssets = [] |
715 for mark in sorted(succmarkers[current]): | 720 for mark in sortedmarkers(succmarkers[current]): |
716 # successors sets contributed by this marker | 721 # successors sets contributed by this marker |
717 base = _succs() | 722 base = _succs() |
718 base.markers.add(mark) | 723 base.markers.add(mark) |
719 markss = [base] | 724 markss = [base] |
720 for suc in mark[1]: | 725 for suc in mark[1]: |