changeset 6704:3635782b0290 stable

topic: compatibility for phase roots being revnums
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 23 Feb 2024 14:52:09 -0300
parents ddebaa161306
children 920f767589df 479131df93a6
files hgext3rd/topic/topicmap.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/topicmap.py	Thu Feb 22 14:10:01 2024 -0300
+++ b/hgext3rd/topic/topicmap.py	Fri Feb 23 14:52:09 2024 -0300
@@ -68,16 +68,16 @@
 
 def _phaseshash(repo, maxrev):
     """uniq ID for a phase matching a set of rev"""
-    revs = set()
     cl = repo.changelog
     fr = cl.filteredrevs
-    getrev = compat.getgetrev(cl)
-    for n in compat.nonpublicphaseroots(repo):
-        r = getrev(n)
-        if r not in fr and r < maxrev:
-            revs.add(r)
+    nppr = compat.nonpublicphaseroots(repo)
+    # starting with hg 6.7rc0 phase roots are already revs instead of nodes
+    # hg <= 6.6 (68289ed170c7)
+    if not util.safehasattr(repo._phasecache, '_phaseroots'):
+        getrev = compat.getgetrev(cl)
+        nppr = set(getrev(n) for n in nppr)
+    revs = sorted(set(r for r in nppr if r not in fr and r < maxrev))
     key = nullid
-    revs = sorted(revs)
     if revs:
         s = hashlib.sha1()
         for rev in revs: