# HG changeset patch # User Joerg Sonnenberger # Date 1595303950 -28800 # Node ID 2c5e4339538a210c093a7a887c690257baba7229 # Parent ca76e63e76dc8225e7bf26f91cdb7be8e327c636 serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5 See also: https://phab.mercurial-scm.org/D8694 and its stack. diff -r ca76e63e76dc -r 2c5e4339538a hgext3rd/serverminitopic.py --- a/hgext3rd/serverminitopic.py Fri Jul 17 10:00:43 2020 +0800 +++ b/hgext3rd/serverminitopic.py Tue Jul 21 11:59:10 2020 +0800 @@ -33,6 +33,14 @@ default=False, ) +# hg <= 5.4 (e2d17974a869) +def nonpublicphaseroots(repo): + if util.safehasattr(repo._phasecache, 'nonpublicphaseroots'): + return repo._phasecache.nonpublicphaseroots(repo) + return set().union( + *[roots for roots in repo._phasecache.phaseroots[1:] if roots] + ) + def hasminitopic(repo): """true if minitopic is enabled on the repository @@ -106,11 +114,10 @@ cl = repo.changelog fr = cl.filteredrevs nm = cl.nodemap - for roots in repo._phasecache.phaseroots[1:]: - for n in roots: - r = nm.get(n) - if r not in fr and r < maxrev: - revs.add(r) + for n in nonpublicphaseroots(repo): + r = nm.get(n) + if r not in fr and r < maxrev: + revs.add(r) key = node.nullid revs = sorted(revs) if revs: