comparison hgext3rd/topic/discovery.py @ 5193:a4d081923c81

compat: update hg-X.Y compat comments and test them
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 10 Mar 2020 19:05:08 +0700
parents 26b47a967a1d
children 034d6d0efa7d
comparison
equal deleted inserted replaced
5192:f5b366a31740 5193:a4d081923c81
155 tr = op.gettransaction() 155 tr = op.gettransaction()
156 if tr.hookargs[b'source'] not in (b'push', b'serve'): # not a push 156 if tr.hookargs[b'source'] not in (b'push', b'serve'): # not a push
157 return 157 return
158 tr._prepushheads = _nbheads(op.repo) 158 tr._prepushheads = _nbheads(op.repo)
159 reporef = weakref.ref(op.repo) 159 reporef = weakref.ref(op.repo)
160 if util.safehasattr(tr, 'validator'): # hg <= 4.7 160 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66)
161 oldvalidator = tr.validator 161 oldvalidator = tr.validator
162 else: 162 else:
163 oldvalidator = tr._validator 163 oldvalidator = tr._validator
164 164
165 def validator(tr): 165 def validator(tr):
176 if 1 < newnb: 176 if 1 < newnb:
177 msg = _(b'push create more than 1 head on new branch "%s"' 177 msg = _(b'push create more than 1 head on new branch "%s"'
178 % branch) 178 % branch)
179 raise error.Abort(msg) 179 raise error.Abort(msg)
180 return oldvalidator(tr) 180 return oldvalidator(tr)
181 if util.safehasattr(tr, 'validator'): # hg <= 4.7 181 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66)
182 tr.validator = validator 182 tr.validator = validator
183 else: 183 else:
184 tr._validator = validator 184 tr._validator = validator
185 handlecheckheads.params = frozenset() 185 handlecheckheads.params = frozenset()
186 186