Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/obsutil.py Wed Nov 06 16:54:34 2019 +0100 +++ b/mercurial/obsutil.py Sat Nov 09 10:31:58 2019 +0100 @@ -112,6 +112,11 @@ yield marker(repo, markerdata) +def sortedmarkers(markers): + # last item of marker tuple ('parents') may be None or a tuple + return sorted(markers, key=lambda m: m[:-1] + (m[-1] or (),)) + + def closestpredecessors(repo, nodeid): """yield the list of next predecessors pointing on visible changectx nodes @@ -675,7 +680,7 @@ # Having none means pruned node, multiple successors means split, # single successors are standard replacement. # - for mark in sorted(succmarkers[current]): + for mark in sortedmarkers(succmarkers[current]): for suc in mark[1]: if suc not in cache: if suc in stackedset: @@ -712,7 +717,7 @@ # duplicated entry and successors set that are strict subset of # another one. succssets = [] - for mark in sorted(succmarkers[current]): + for mark in sortedmarkers(succmarkers[current]): # successors sets contributed by this marker base = _succs() base.markers.add(mark)