# HG changeset patch # User Anton Shestakov # Date 1584682664 -25200 # Node ID d7f87c7cb1f01dda13ed21572750960d5340bda4 # Parent 034d6d0efa7d6826860dc402970a27f564d16dd1 topic: compat with tr.changes[b'phases'], it's now a list diff -r 034d6d0efa7d -r d7f87c7cb1f0 hgext3rd/topic/flow.py --- 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]