diff hgext3rd/topic/discovery.py @ 6386:9b5660737b52

topic: compatibility for wrapping branchinfo() and _branchinfo() in hg 4.8
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 05 Feb 2023 19:55:48 +0400
parents afd252e8f6e6
children 963471ebe26a 30d0d3d92c8d
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py	Sun Feb 05 19:01:32 2023 +0400
+++ b/hgext3rd/topic/discovery.py	Sun Feb 05 19:55:48 2023 +0400
@@ -324,9 +324,11 @@
         caps.append(b'topics-namespaces')
     return caps
 
-def wrapbranchinfo(orig, self, rev):
+# **kwargs is for accommodating an optional changelog argument
+# hg <= 4.8 (5e5c8f2a1eb5)
+def wrapbranchinfo(orig, self, rev, **kwargs):
     # NOTE: orig can be either branchinfo() or _branchinfo()!
-    b, close = orig(self, rev)
+    b, close = orig(self, rev, **kwargs)
     if common.hastopicext(self._repo):
         if self._repo.ui.configbool(b'_internal', b'tns-disable-fqbn'):
             # the config option prevents this function from doing anything,
@@ -341,14 +343,16 @@
             b = ctx.fqbn()
     return b, close
 
-def wrapslowbranchinfo(orig, self, rev):
+# **kwargs is for accommodating an optional changelog argument
+# hg <= 4.8 (5e5c8f2a1eb5)
+def wrapslowbranchinfo(orig, self, rev, **kwargs):
     if self.branchinfo == self._branchinfo:
         # _branchinfo() gets called directly and needs to do the conversion
-        return wrapbranchinfo(orig, self, rev)
+        return wrapbranchinfo(orig, self, rev, **kwargs)
     else:
         # _branchinfo() gets called through branchinfo(), the latter will need
         # to do the conversion
-        return orig(self, rev)
+        return orig(self, rev, **kwargs)
 
 def modsetup(ui):
     """run at uisetup time to install all destinations wrapping"""