hgext3rd/topic/discovery.py
branchstable
changeset 4123 119fced5a891
parent 3917 ca7f02c9fa57
child 4187 49d442a2207f
child 4192 e527df0f2a68
--- a/hgext3rd/topic/discovery.py	Fri Sep 21 11:58:42 2018 +0200
+++ b/hgext3rd/topic/discovery.py	Fri Sep 21 17:50:28 2018 +0200
@@ -153,7 +153,10 @@
         return
     tr._prepushheads = _nbheads(op.repo)
     reporef = weakref.ref(op.repo)
-    oldvalidator = tr.validator
+    if util.safehasattr(tr, 'validator'): # hg <= 4.7
+        oldvalidator = tr.validator
+    else:
+        oldvalidator = tr._validator
 
     def validator(tr):
         repo = reporef()
@@ -171,7 +174,10 @@
                             % branch)
                     raise error.Abort(msg)
         return oldvalidator(tr)
-    tr.validator = validator
+    if util.safehasattr(tr, 'validator'): # hg <= 4.7
+        tr.validator = validator
+    else:
+        tr._validator = validator
 handlecheckheads.params = frozenset()
 
 def _pushb2phases(orig, pushop, bundler):