changeset 1602:6a6ce9d9da35 default tip

compathacks: make memfilectx construction compatible with hg5.0 'copied' in memfilectx was renamed to 'copysource' in 550a172a603b9ed in core mercurial.
author Pulkit Goyal <pulkit@yandex-team.ru>
date Fri, 19 Apr 2019 16:28:39 +0300
parents 5d8603f080c5
children
files hgsubversion/compathacks.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/compathacks.py
+++ b/hgsubversion/compathacks.py
@@ -26,6 +26,7 @@ def makememfilectx(repo, memctx, path, d
     """Return a memfilectx
 
     Works around API change by 8a0cac20a1ad (first in 4.5).
+    and also API change by 550a172a603b9e (first in 5.0)
     """
     from mercurial import context
     try:
@@ -33,8 +34,15 @@ def makememfilectx(repo, memctx, path, d
                                   islink=islink, isexec=isexec, copied=copied,
                                   changectx=memctx)
     except TypeError:
-        return context.memfilectx(repo=repo, path=path, data=data,
-                                  islink=islink, isexec=isexec, copied=copied)
+        try:
+            return context.memfilectx(repo=repo, path=path, data=data,
+                                      islink=islink, isexec=isexec,
+                                      copied=copied)
+        except TypeError:
+            return context.memfilectx(repo=repo, changectx=memctx,
+                                      path=path, data=data,
+                                      islink=islink, isexec=isexec,
+                                      copysource=copied)
 
 def filectxfn_deleted(memctx, path):
     """