Mercurial > hg-stable
changeset 50561:dc372251d4dc
stabletailgraph: extract _parents util func
author | pacien <pacien.trangirard@pacien.net> |
---|---|
date | Fri, 21 Apr 2023 16:19:32 +0200 |
parents | 4fd2f7ab4177 |
children | 8fb3e942473a |
files | mercurial/stabletailgraph/stabletailsort.py |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/stabletailgraph/stabletailsort.py Mon May 22 19:04:05 2023 +0200 +++ b/mercurial/stabletailgraph/stabletailsort.py Fri Apr 21 16:19:32 2023 +0200 @@ -74,6 +74,14 @@ return p1, p2 +def _parents(cl, rev): + p1, p2 = _nonoedipal_parent_revs(cl, rev) + if p2 == nullrev: + return p1, p2 + + return _sorted_parents(cl, p1, p2) + + def _stable_tail_sort_naive(cl, head_rev): """ Naive topological iterator of the ancestors given by the stable-tail sort. @@ -91,14 +99,10 @@ while cursor_rev != nullrev: yield cursor_rev - p1, p2 = _nonoedipal_parent_revs(cl, cursor_rev) - if p1 == nullrev: - cursor_rev = p2 - elif p2 == nullrev: - cursor_rev = p1 + px, pt = _parents(cl, cursor_rev) + if pt == nullrev: + cursor_rev = px else: - px, pt = _sorted_parents(cl, p1, p2) - tail_ancestors = ancestor.lazyancestors( cl.parentrevs, (pt,), inclusive=True )