# HG changeset patch # User Anton Shestakov # Date 1660574755 -14400 # Node ID c00332abb66b54e97b6c72172c012f7716e74c42 # Parent 1c78d704bea4c027511f426e35adc1f738c5a81b topic: remove 4.7 compat for transaction validators diff -r 1c78d704bea4 -r c00332abb66b hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Thu Aug 11 11:22:26 2022 +0400 +++ b/hgext3rd/topic/__init__.py Mon Aug 15 18:45:55 2022 +0400 @@ -638,9 +638,7 @@ reporef = weakref.ref(self) if self.ui.configbool(b'experimental', b'enforce-single-head'): - if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) - origvalidator = tr.validator - elif util.safehasattr(tr, '_validator'): + if util.safehasattr(tr, '_validator'): # hg <= 5.3 (36f08ae87ef6) origvalidator = tr._validator else: @@ -654,9 +652,7 @@ _validate(tr2) origvalidator(tr2) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) - tr.validator = validator - elif util.safehasattr(tr, '_validator'): + if util.safehasattr(tr, '_validator'): # hg <= 5.3 (36f08ae87ef6) tr._validator = validator else: @@ -668,9 +664,7 @@ b'topic.publish-bare-branch') ispush = desc.startswith((b'push', b'serve')) if (topicmodeserver != b'ignore' and ispush): - if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) - origvalidator = tr.validator - elif util.safehasattr(tr, '_validator'): + if util.safehasattr(tr, '_validator'): # hg <= 5.3 (36f08ae87ef6) origvalidator = tr._validator else: @@ -684,9 +678,7 @@ _validate(tr2) return origvalidator(tr2) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) - tr.validator = validator - elif util.safehasattr(tr, '_validator'): + if util.safehasattr(tr, '_validator'): # hg <= 5.3 (36f08ae87ef6) tr._validator = validator else: @@ -706,9 +698,7 @@ b'topic.allow-publish', True) if not allow_publish: - if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) - origvalidator = tr.validator - elif util.safehasattr(tr, '_validator'): + if util.safehasattr(tr, '_validator'): # hg <= 5.3 (36f08ae87ef6) origvalidator = tr._validator else: @@ -722,9 +712,7 @@ _validate(tr2) return origvalidator(tr2) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) - tr.validator = validator - elif util.safehasattr(tr, '_validator'): + if util.safehasattr(tr, '_validator'): # hg <= 5.3 (36f08ae87ef6) tr._validator = validator else: diff -r 1c78d704bea4 -r c00332abb66b hgext3rd/topic/discovery.py --- a/hgext3rd/topic/discovery.py Thu Aug 11 11:22:26 2022 +0400 +++ b/hgext3rd/topic/discovery.py Mon Aug 15 18:45:55 2022 +0400 @@ -265,9 +265,7 @@ return tr._prepushheads = _nbheads(op.repo) reporef = weakref.ref(op.repo) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) - oldvalidator = tr.validator - elif util.safehasattr(tr, '_validator'): + if util.safehasattr(tr, '_validator'): # hg <= 5.3 (36f08ae87ef6) oldvalidator = tr._validator @@ -303,9 +301,7 @@ _validate(tr) return oldvalidator(tr) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) - tr.validator = validator - elif util.safehasattr(tr, '_validator'): + if util.safehasattr(tr, '_validator'): # hg <= 5.3 (36f08ae87ef6) tr._validator = validator else: