# HG changeset patch # User Anton Shestakov # Date 1704911943 10800 # Node ID 691a9301b51e13c299e645717da373a70c6d6140 # Parent f0cbc19e77ef621958cebc08b24ed45842d764bf topic: drop compatibility for tr.changes[b'phases'] being a dict in hg 5.3 diff -r f0cbc19e77ef -r 691a9301b51e hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed Jan 10 15:28:20 2024 -0300 +++ b/hgext3rd/topic/__init__.py Wed Jan 10 15:39:03 2024 -0300 @@ -482,11 +482,7 @@ # - forcefully making changesets draft again # - turning secret changesets draft and making them visible to peers tnsphases = (phases.secret, phases.draft) - phasechanges = tr.changes[b'phases'] - if isinstance(phasechanges, dict): - # hg <= 5.3 (fdc802f29b2c) - phasechanges = [((k,), v) for k, v in phasechanges.items()] - for revs, (old, new) in phasechanges: + for revs, (old, new) in tr.changes[b'phases']: if old not in tnsphases and new not in tnsphases: # Skip phase movement if there is no phase (old or new) that has # visible topic namespace (i.e. draft and secret) diff -r f0cbc19e77ef -r 691a9301b51e hgext3rd/topic/flow.py --- 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]