diff hgext3rd/topic/flow.py @ 6702:691a9301b51e

topic: drop compatibility for tr.changes[b'phases'] being a dict in hg 5.3
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 10 Jan 2024 15:39:03 -0300
parents 995c6163e97b
children 6adcc5c7c1f1
line wrap: on
line diff
--- a/hgext3rd/topic/flow.py	Wed Jan 10 15:28:20 2024 -0300
+++ b/hgext3rd/topic/flow.py	Wed Jan 10 15:39:03 2024 -0300
@@ -5,7 +5,6 @@
     exchange,
     node,
     phases,
-    util,
 )
 
 from mercurial.i18n import _
@@ -61,18 +60,11 @@
 
 def reject_publish(repo, tr):
     """prevent a transaction to be publish anything"""
-    if util.safehasattr(tr.changes[b'phases'], 'items'):
-        # hg <= 5.3 (fdc802f29b2c)
-        published = {
-            r for r, (o, n) in tr.changes[b'phases'].items()
-            if n == phases.public
-        }
-    else:
-        revranges = [
-            r for r, (o, n) in tr.changes[b'phases']
-            if n == phases.public
-        ]
-        published = {r for revrange in revranges for r in revrange}
+    revranges = [
+        r for r, (o, n) in tr.changes[b'phases']
+        if n == phases.public
+    ]
+    published = {r for revrange in revranges for r in revrange}
     if published:
         r = min(published)
         msg = b"rejecting publishing of changeset %s" % repo[r]