Mercurial > evolve
changeset 2212:afb35ad42040
stablesort: allow a callback to be triggered on merge
Storing some information as we sort is going to be useful to avoid performing
multiple sort while computing the stablerange.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 24 Mar 2017 03:22:56 +0100 |
parents | ecb46c7ee281 |
children | fb2937b0dd49 |
files | hgext3rd/evolve/stablerange.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py Fri Mar 24 03:33:36 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Fri Mar 24 03:22:56 2017 +0100 @@ -46,7 +46,7 @@ displayer.flush(ctx) displayer.close() -def stablesort(repo, revs): +def stablesort(repo, revs, mergecallback=None): """return '::revs' topologically sorted in "stable" order This is a depth first traversal starting from 'nullrev', using node as a @@ -113,6 +113,8 @@ assert not seen[current] seen[current] = True result.append(current) # could be yield, cf earlier comment + if mergecallback is not None and p2 != nullrev: + mergecallback(result, current) cs = children[current] if not cs: current = None