changeset 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 0bc90758f613
children 0baef8dde96b f689940666ba
files hgext3rd/topic/discovery.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
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"""