diff hgext3rd/topic/__init__.py @ 6304:c00332abb66b

topic: remove 4.7 compat for transaction validators
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 15 Aug 2022 18:45:55 +0400
parents a2855aff1268
children 77ce98287dc2
line wrap: on
line diff
--- 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: