Mercurial > evolve
changeset 3319:bacb44f4f33e
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 20 Dec 2017 12:29:02 +0100 |
parents | 058120e9d32f |
children | 360a543930c6 |
files | hgext3rd/evolve/stablesort.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 = {