# HG changeset patch # User Boris Feld # Date 1513329282 -3600 # Node ID f4b06f44d27403cbd2c040b4bace7d48ac69ce81 # Parent 4d7e002a2bb50bd48cc327dcff8635dbd34b805b memfilectx: changectx argument is not mandatory As changectx argument is now mandatory for memfilectx, add a compatibility layer to pass it when necessary. The commit that made the parament mandatory in core is 8a0cac20a1ad diff -r 4d7e002a2bb5 -r f4b06f44d274 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Sat Dec 16 23:52:32 2017 +0100 +++ b/hgext3rd/evolve/__init__.py Fri Dec 15 10:14:42 2017 +0100 @@ -1830,10 +1830,7 @@ if path in bumped: fctx = bumped[path] flags = fctx.flags() - mctx = context.memfilectx(repo, fctx.path(), fctx.data(), - islink='l' in flags, - isexec='x' in flags, - copied=copied.get(path)) + mctx = compat.memfilectx(repo, ctx, fctx, flags, copied, path) return mctx return None text = 'bumped update to %s:\n\n' % prec diff -r 4d7e002a2bb5 -r f4b06f44d274 hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Sat Dec 16 23:52:32 2017 +0100 +++ b/hgext3rd/evolve/cmdrewrite.py Fri Dec 15 10:14:42 2017 +0100 @@ -179,10 +179,7 @@ return None fctx = contentctx[path] flags = fctx.flags() - mctx = context.memfilectx(repo, fctx.path(), fctx.data(), - islink='l' in flags, - isexec='x' in flags, - copied=copied.get(path)) + mctx = compat.memfilectx(repo, memctx, fctx, flags, copied, path) return mctx if message is None: diff -r 4d7e002a2bb5 -r f4b06f44d274 hgext3rd/evolve/compat.py --- a/hgext3rd/evolve/compat.py Sat Dec 16 23:52:32 2017 +0100 +++ b/hgext3rd/evolve/compat.py Fri Dec 15 10:14:42 2017 +0100 @@ -195,3 +195,20 @@ copies.duplicatecopies(repo, rev, fromrev, skiprev=skiprev) else: copies.duplicatecopies(repo, wctx, rev, fromrev, skiprev=skiprev) + +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: + mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(), + islink='l' in flags, + isexec='x' in flags, + copied=copied.get(path)) + else: + mctx = context.memfilectx(repo, fctx.path(), fctx.data(), + islink='l' in flags, + isexec='x' in flags, + copied=copied.get(path)) + return mctx diff -r 4d7e002a2bb5 -r f4b06f44d274 hgext3rd/evolve/rewriteutil.py --- a/hgext3rd/evolve/rewriteutil.py Sat Dec 16 23:52:32 2017 +0100 +++ b/hgext3rd/evolve/rewriteutil.py Fri Dec 15 10:14:42 2017 +0100 @@ -201,10 +201,7 @@ if path in headmf: fctx = head[path] flags = fctx.flags() - mctx = context.memfilectx(repo, fctx.path(), fctx.data(), - islink='l' in flags, - isexec='x' in flags, - copied=copied.get(path)) + mctx = compat.memfilectx(repo, ctx, fctx, flags, copied, path) return mctx return None