hgext3rd/evolve/stablesort.py
changeset 3320 360a543930c6
parent 3319 bacb44f4f33e
child 3321 14024940f369
--- a/hgext3rd/evolve/stablesort.py	Wed Dec 20 12:29:02 2017 +0100
+++ b/hgext3rd/evolve/stablesort.py	Wed Dec 20 12:36:45 2017 +0100
@@ -310,10 +310,6 @@
                      '    %s\n' % (first, second))
     return second
 
-JUMPSOFT = 1  # jump when a branch have been explored
-JUMPHARD = 2  # jump because we reach the outside of the exclusive area
-JUMPFINAL = 3 # jump because we are done sorting the exclusive area
-
 class stablesortcache(object):
 
     def __init__(self):
@@ -389,15 +385,15 @@
                 rev = current
                 jumps = []
 
-                def recordjump(source, destination, jumptype):
-                    jump = (source, destination, jumptype)
+                def recordjump(source, destination):
+                    jump = (source, destination)
                     jumps.append(jump)
                 process = self._process_exclusive_side
                 for rev in process(lower_parent, higher_parent, cl, parents,
                                    tiebreaker, recordjump):
                     yield rev
 
-                recordjump(rev, lower_parent, JUMPFINAL)
+                recordjump(rev, lower_parent)
 
                 self._jumps[current] = jumps
 
@@ -435,7 +431,7 @@
             if 2 <= len(all_parents):
                 max_parents = max(all_parents, key=tiebreaker)
 
-            jump_type = None
+            jump = False
 
             ready_parents = [p for p in all_parents
                              if children[p].issubset(seen)]
@@ -444,16 +440,16 @@
 
             if (len(all_parents) != len(ready_parents)
                     and max_parents not in ready_parents):
-                jump_type = JUMPSOFT
+                jump = True
             elif (len(ready_parents) != len(okay_parents)
                     and max_parents not in okay_parents):
-                jump_type = JUMPHARD
+                jump = True
             elif not all_parents:
-                jump_type = JUMPSOFT
+                jump = True
 
             if not okay_parents:
-                if jump_type is None:
-                    jump_type = JUMPSOFT
+                if jump is None:
+                    jump = True
                 if stack:
                     next = stack.pop()
                 else:
@@ -464,8 +460,8 @@
                 lower_parent, higher_parent = sorted(ready_parents, key=tiebreaker)
                 stack.append(lower_parent)
                 next = higher_parent
-            if jump_type is not None and next is not None:
-                recordjump(current, next, jump_type)
+            if jump is not None and next is not None:
+                recordjump(current, next)
             current = next
 
 _methodmap = {