changeset 4460:dd679f5fc96f stable

compat: add support for new arg name in memfilectx.__init__ This makes us compatible with 550a172a603b (memctx: rename constructor argument "copied" to "copysource" (API), 2019-03-19).
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 22 Mar 2019 09:45:07 -0700
parents d46360b8c0dc
children 7f87ef9f0224
files hgext3rd/evolve/compat.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/compat.py	Wed Nov 21 12:00:46 2018 +0000
+++ b/hgext3rd/evolve/compat.py	Fri Mar 22 09:45:07 2019 -0700
@@ -143,9 +143,14 @@
 def memfilectx(repo, ctx, fctx, flags, copied, path):
     # XXX Would it be better at the module level?
     varnames = context.memfilectx.__init__.__code__.co_varnames
-    ctxmandatory = varnames[2] == "changectx"
 
-    if ctxmandatory:
+    if "copysource" in varnames:
+        mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(),
+                                  islink='l' in flags,
+                                  isexec='x' in flags,
+                                  copysource=copied.get(path))
+    # compat with hg <- 4.9
+    elif varnames[2] == "changectx":
         mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(),
                                   islink='l' in flags,
                                   isexec='x' in flags,