# HG changeset patch # User Joerg Sonnenberger # Date 1595303950 -28800 # Node ID 3214dc2820856e97d878263c589b93e99c6140ae # Parent 1b5afe8bb26aad450dda531e1103feead31d9d38 serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5 See also: https://phab.mercurial-scm.org/D8694 and its stack. diff -r 1b5afe8bb26a -r 3214dc282085 hgext3rd/serverminitopic.py --- a/hgext3rd/serverminitopic.py Sat Jun 27 22:46:08 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: