Mercurial > evolve
changeset 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 | f0cbc19e77ef |
children | cc49139f580f |
files | hgext3rd/topic/__init__.py hgext3rd/topic/flow.py |
diffstat | 2 files changed, 6 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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]