changeset 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 1c78d704bea4
children 77ce98287dc2
files hgext3rd/topic/__init__.py hgext3rd/topic/discovery.py
diffstat 2 files changed, 8 insertions(+), 24 deletions(-) [+]
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:
--- 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: