comparison hgext3rd/topic/discovery.py @ 6607:ff2ba083f8b4

topic: drop compatibility for branchinfo(..., changelog=None) for hg 4.8
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 03 Nov 2023 15:44:25 -0300
parents d511eba4cdb0
children 31e157a5cfe2
comparison
equal deleted inserted replaced
6606:c7083ba82d5f 6607:ff2ba083f8b4
323 if common.hastopicext(repo) and repo.peer().capable(b'topics'): 323 if common.hastopicext(repo) and repo.peer().capable(b'topics'):
324 caps.append(b'topics') 324 caps.append(b'topics')
325 caps.append(b'topics-namespaces') 325 caps.append(b'topics-namespaces')
326 return caps 326 return caps
327 327
328 # **kwargs is for accommodating an optional changelog argument 328 def wrapbranchinfo(orig, self, rev):
329 # hg <= 4.8 (5e5c8f2a1eb5)
330 def wrapbranchinfo(orig, self, rev, **kwargs):
331 # NOTE: orig can be either branchinfo() or _branchinfo()! 329 # NOTE: orig can be either branchinfo() or _branchinfo()!
332 b, close = orig(self, rev, **kwargs) 330 b, close = orig(self, rev)
333 if common.hastopicext(self._repo): 331 if common.hastopicext(self._repo):
334 if self._repo.ui.configbool(b'_internal', b'tns-disable-fqbn'): 332 if self._repo.ui.configbool(b'_internal', b'tns-disable-fqbn'):
335 # the config option prevents this function from doing anything, 333 # the config option prevents this function from doing anything,
336 # this happens when e.g. the remote repo doesn't have topic 334 # this happens when e.g. the remote repo doesn't have topic
337 # extension enabled 335 # extension enabled
342 else: 340 else:
343 ctx = self._repo[rev] 341 ctx = self._repo[rev]
344 b = ctx.fqbn() 342 b = ctx.fqbn()
345 return b, close 343 return b, close
346 344
347 # **kwargs is for accommodating an optional changelog argument 345 def wrapslowbranchinfo(orig, self, rev):
348 # hg <= 4.8 (5e5c8f2a1eb5)
349 def wrapslowbranchinfo(orig, self, rev, **kwargs):
350 if self.branchinfo == self._branchinfo: 346 if self.branchinfo == self._branchinfo:
351 # _branchinfo() gets called directly and needs to do the conversion 347 # _branchinfo() gets called directly and needs to do the conversion
352 return wrapbranchinfo(orig, self, rev, **kwargs) 348 return wrapbranchinfo(orig, self, rev)
353 else: 349 else:
354 # _branchinfo() gets called through branchinfo(), the latter will need 350 # _branchinfo() gets called through branchinfo(), the latter will need
355 # to do the conversion 351 # to do the conversion
356 return orig(self, rev, **kwargs) 352 return orig(self, rev)
357 353
358 def wrapaddpartrevbranchcache(orig, repo, bundler, outgoing): 354 def wrapaddpartrevbranchcache(orig, repo, bundler, outgoing):
359 """making sure we send rev-branch-cache that only has bare branches""" 355 """making sure we send rev-branch-cache that only has bare branches"""
360 overrides = {(b'_internal', b'tns-disable-fqbn'): True} 356 overrides = {(b'_internal', b'tns-disable-fqbn'): True}
361 with repo.ui.configoverride(overrides, b'topic-namespaces'): 357 with repo.ui.configoverride(overrides, b'topic-namespaces'):