Skip to content
Snippets Groups Projects

topic: compat with tr.changes[b'phases'], it's now a list

Closed Anton Shestakov requested to merge topic/default/phases-revranges into branch/default
1 file
+ 13
4
Compare changes
  • Side-by-side
  • Inline
+ 13
4
@@ -7,6 +7,7 @@ from mercurial import (
extensions,
node,
phases,
util,
)
from mercurial.i18n import _
@@ -62,10 +63,18 @@ def rejectuntopicedchangeset(repo, tr):
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]
Loading