changeset 6048:761124310764

compat: cmdutil.check_incompatible_arguments() takes a list only on 5.4+
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 11 Oct 2021 10:58:51 +0300
parents 6d29d97f4853
children 441e7e773d6c
files hgext3rd/evolve/compat.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/compat.py	Fri Oct 08 14:38:48 2021 +0300
+++ b/hgext3rd/evolve/compat.py	Mon Oct 11 10:58:51 2021 +0300
@@ -439,8 +439,14 @@
         return previous
 
 if util.safehasattr(cmdutil, 'check_incompatible_arguments'):
-    def check_incompatible_arguments(opts, first, others):
-        return cmdutil.check_incompatible_arguments(opts, first, others)
+    code = cmdutil.check_incompatible_arguments.__code__
+    if r'others' in code.co_varnames[:code.co_argcount]:
+        def check_incompatible_arguments(opts, first, others):
+            return cmdutil.check_incompatible_arguments(opts, first, others)
+    else:
+        # hg <= 5.3 (d4c1501225c4)
+        def check_incompatible_arguments(opts, first, others):
+            return cmdutil.check_incompatible_arguments(opts, first, *others)
 else:
     # hg <= 5.2 (023ad45e2fd2)
     def check_incompatible_arguments(opts, first, others):