diff hgext3rd/topic/topicmap.py @ 6705:920f767589df

branching: merge with stable
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 25 Feb 2024 15:55:13 -0300
parents 0f8dbea4458e 3635782b0290
children 71c4b6c2bcdc
line wrap: on
line diff
--- a/hgext3rd/topic/topicmap.py	Thu Jan 11 13:21:08 2024 -0300
+++ b/hgext3rd/topic/topicmap.py	Sun Feb 25 15:55:13 2024 -0300
@@ -69,16 +69,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: