--- a/hgext3rd/topic/flow.py Thu Mar 19 20:09:18 2020 +0530
+++ b/hgext3rd/topic/flow.py Fri Mar 20 12:37:44 2020 +0700
@@ -7,6 +7,7 @@
extensions,
node,
phases,
+ util,
)
from mercurial.i18n import _
@@ -62,10 +63,18 @@
def reject_publish(repo, tr):
"""prevent a transaction to be publish anything"""
- published = set()
- for r, (o, n) in tr.changes[b'phases'].items():
- if n == phases.public:
- published.add(r)
+ 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}
if published:
r = min(published)
msg = b"rejecting publishing of changeset %s" % repo[r]