# HG changeset patch # User Joerg Sonnenberger # Date 1595303968 -28800 # Node ID e4c7d4a03de77863c8473c8307f45230f9b093ed # Parent 3214dc2820856e97d878263c589b93e99c6140ae topic: compatibility with sparse phaseroots and phasesets in 5.5 See also: https://phab.mercurial-scm.org/D8694 and its stack. diff -r 3214dc282085 -r e4c7d4a03de7 hgext3rd/topic/compat.py --- a/hgext3rd/topic/compat.py Tue Jul 21 11:59:10 2020 +0800 +++ b/hgext3rd/topic/compat.py Tue Jul 21 11:59:28 2020 +0800 @@ -38,3 +38,11 @@ if util.safehasattr(cl.index, 'get_rev'): return cl.index.get_rev return cl.nodemap.get + +# 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] + ) diff -r 3214dc282085 -r e4c7d4a03de7 hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Tue Jul 21 11:59:10 2020 +0800 +++ b/hgext3rd/topic/stack.py Tue Jul 21 11:59:28 2020 +0800 @@ -44,10 +44,10 @@ this area. """ phasesets = repo._phasecache._phasesets - if not phasesets or None in phasesets[phases.draft:]: + if not phasesets: return repo.revs(b'(not public()) - obsolete()') - result = set.union(*phasesets[phases.draft:]) + result = set.union(*[phasesets[phase] for phase in phases.trackedphases]) result -= obsolete.getrevs(repo, b'obsolete') return result diff -r 3214dc282085 -r e4c7d4a03de7 hgext3rd/topic/topicmap.py --- a/hgext3rd/topic/topicmap.py Tue Jul 21 11:59:10 2020 +0800 +++ b/hgext3rd/topic/topicmap.py Tue Jul 21 11:59:28 2020 +0800 @@ -71,11 +71,10 @@ cl = repo.changelog fr = cl.filteredrevs getrev = compat.getgetrev(cl) - for roots in repo._phasecache.phaseroots[1:]: - for n in roots: - r = getrev(n) - if r not in fr and r < maxrev: - revs.add(r) + for n in compat.nonpublicphaseroots(repo): + r = getrev(n) + if r not in fr and r < maxrev: + revs.add(r) key = nullid revs = sorted(revs) if revs: