changeset 6455:31296f71c121 stable

precheck: use getargspec() instead of using __code__ for checking arguments Apparently when precheck() in core was wrapped in functools.partial(), this code was broken ("functools.partial has no attribute '__code__'").
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 16 Mar 2023 20:42:55 -0300
parents 2a2fde6c0aec
children a80ed2e4745b
files hgext3rd/evolve/rewriteutil.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/rewriteutil.py	Thu Mar 16 20:29:53 2023 -0300
+++ b/hgext3rd/evolve/rewriteutil.py	Thu Mar 16 20:42:55 2023 -0300
@@ -23,6 +23,7 @@
     node,
     obsolete,
     obsutil,
+    pycompat,
     revset,
     rewriteutil as corerewriteutil,
     scmutil,
@@ -60,8 +61,8 @@
     <action> can be used to control the commit message.
     """
     # hg <= 6.1 (d4752aeb20f1)
-    code = corerewriteutil.precheck.__code__
-    if r'check_divergence' in code.co_varnames[:code.co_argcount]:
+    args = pycompat.getargspec(corerewriteutil.precheck).args
+    if r'check_divergence' in args:
         return corerewriteutil.precheck(repo, revs, action,
                                         check_divergence=check_divergence)