stablesort: pass a jump recording function instead of a list
This seems cleaner to abstract the underlying storage to the lower level. This
also makes use more flexible about jump detection.
--- a/hgext3rd/evolve/stablesort.py Wed Dec 20 12:27:17 2017 +0100
+++ b/hgext3rd/evolve/stablesort.py Wed Dec 20 12:29:02 2017 +0100
@@ -388,19 +388,23 @@
rev = current
jumps = []
+
+ def recordjump(source, destination, jumptype):
+ jump = (source, destination, jumptype)
+ jumps.append(jump)
process = self._process_exclusive_side
for rev in process(lower_parent, higher_parent, cl, parents,
- tiebreaker, jumps):
+ tiebreaker, recordjump):
yield rev
- jumps.append((rev, lower_parent, JUMPFINAL))
+ recordjump(rev, lower_parent, JUMPFINAL)
self._jumps[current] = jumps
current = lower_parent
def _process_exclusive_side(self, lower, higher, cl, parents, tiebreaker,
- jumps):
+ recordjump):
exclusive = cl.findmissingrevs(common=[lower], heads=[higher])
@@ -461,7 +465,7 @@
stack.append(lower_parent)
next = higher_parent
if jump_type is not None and next is not None:
- jumps.append((current, next, jump_type))
+ recordjump(current, next, jump_type)
current = next
_methodmap = {