diff hgext3rd/topic/compat.py @ 5426:86736040b0ec

topic: compatibility with sparse phaseroots and phasesets in 5.5 See also: https://phab.mercurial-scm.org/D8694 and its stack.
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 21 Jul 2020 11:59:28 +0800
parents a4d081923c81
children dd9dba7c1d00
line wrap: on
line diff
--- 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]
+    )