##// END OF EJS Templates
py3: fix sorting of obsolete markers in obsutil (issue6217)...
Denis Laxalde -
r43858:e513e87b stable
parent child Browse files
Show More
@@ -28,6 +28,7 b' from . import ('
28 logexchange,
28 logexchange,
29 narrowspec,
29 narrowspec,
30 obsolete,
30 obsolete,
31 obsutil,
31 phases,
32 phases,
32 pushkey,
33 pushkey,
33 pycompat,
34 pycompat,
@@ -99,11 +100,6 b' class bundlespec(object):'
99 contentopts = attr.ib()
100 contentopts = attr.ib()
100
101
101
102
102 def _sortedmarkers(markers):
103 # last item of marker tuple ('parents') may be None or a tuple
104 return sorted(markers, key=lambda m: m[:-1] + (m[-1] or (),))
105
106
107 def parsebundlespec(repo, spec, strict=True):
103 def parsebundlespec(repo, spec, strict=True):
108 """Parse a bundle string specification into parts.
104 """Parse a bundle string specification into parts.
109
105
@@ -1140,7 +1136,7 b' def _pushb2obsmarkers(pushop, bundler):'
1140 return
1136 return
1141 pushop.stepsdone.add(b'obsmarkers')
1137 pushop.stepsdone.add(b'obsmarkers')
1142 if pushop.outobsmarkers:
1138 if pushop.outobsmarkers:
1143 markers = _sortedmarkers(pushop.outobsmarkers)
1139 markers = obsutil.sortedmarkers(pushop.outobsmarkers)
1144 bundle2.buildobsmarkerspart(bundler, markers)
1140 bundle2.buildobsmarkerspart(bundler, markers)
1145
1141
1146
1142
@@ -1475,7 +1471,7 b' def _pushobsolete(pushop):'
1475 if pushop.outobsmarkers:
1471 if pushop.outobsmarkers:
1476 pushop.ui.debug(b'try to push obsolete markers to remote\n')
1472 pushop.ui.debug(b'try to push obsolete markers to remote\n')
1477 rslts = []
1473 rslts = []
1478 markers = _sortedmarkers(pushop.outobsmarkers)
1474 markers = obsutil.sortedmarkers(pushop.outobsmarkers)
1479 remotedata = obsolete._pushkeyescape(markers)
1475 remotedata = obsolete._pushkeyescape(markers)
1480 for key in sorted(remotedata, reverse=True):
1476 for key in sorted(remotedata, reverse=True):
1481 # reverse sort to ensure we end with dump0
1477 # reverse sort to ensure we end with dump0
@@ -2573,7 +2569,7 b' def _getbundleobsmarkerpart('
2573 heads = repo.heads()
2569 heads = repo.heads()
2574 subset = [c.node() for c in repo.set(b'::%ln', heads)]
2570 subset = [c.node() for c in repo.set(b'::%ln', heads)]
2575 markers = repo.obsstore.relevantmarkers(subset)
2571 markers = repo.obsstore.relevantmarkers(subset)
2576 markers = _sortedmarkers(markers)
2572 markers = obsutil.sortedmarkers(markers)
2577 bundle2.buildobsmarkerspart(bundler, markers)
2573 bundle2.buildobsmarkerspart(bundler, markers)
2578
2574
2579
2575
@@ -112,6 +112,11 b' def getmarkers(repo, nodes=None, exclusi'
112 yield marker(repo, markerdata)
112 yield marker(repo, markerdata)
113
113
114
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 (),))
118
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
@@ -675,7 +680,7 b' def successorssets(repo, initialnode, cl'
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:
@@ -712,7 +717,7 b' def successorssets(repo, initialnode, cl'
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)
General Comments 0
You need to be logged in to leave comments. Login now