changeset 7710:eda137096b3f

hg: prepare for Mercurial 5.0 renaming memfilectx `copied` to `copysource` - add backwards compat wrapper
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 27 May 2019 00:17:32 +0200
parents 0572d5d132c2
children c662d42e1f9c
files kallithea/lib/vcs/backends/hg/inmemory.py kallithea/lib/vcs/utils/hgcompat.py
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/inmemory.py	Sun May 26 23:20:58 2019 +0200
+++ b/kallithea/lib/vcs/backends/hg/inmemory.py	Mon May 27 00:17:32 2019 +0200
@@ -57,7 +57,7 @@
                               if not node.is_binary else node.content),
                         islink=False,
                         isexec=node.is_executable,
-                        copied=False)
+                        copysource=False)
 
             # or changed
             for node in self.changed:
@@ -67,7 +67,7 @@
                               if not node.is_binary else node.content),
                         islink=False,
                         isexec=node.is_executable,
-                        copied=False)
+                        copysource=False)
 
             raise RepositoryError("Given path haven't been marked as added,"
                                   "changed or removed (%s)" % path)
--- a/kallithea/lib/vcs/utils/hgcompat.py	Sun May 26 23:20:58 2019 +0200
+++ b/kallithea/lib/vcs/utils/hgcompat.py	Mon May 27 00:17:32 2019 +0200
@@ -37,3 +37,11 @@
 localrepo.localrepository._lfstatuswriters = [lambda *msg, **opts: None]
 # 3.5 7699d3212994 added the invariant that repo.lfstatus must exist before hitting overridearchive
 localrepo.localrepository.lfstatus = False
+
+# Mercurial 5.0 550a172a603b renamed memfilectx argument `copied` to `copysource`
+import inspect
+if inspect.getargspec(memfilectx.__init__).args[7] != 'copysource':
+    assert inspect.getargspec(memfilectx.__init__).args[7] == 'copied', inspect.getargspec(memfilectx.__init__).args
+    __org_memfilectx_ = memfilectx
+    memfilectx = lambda repo, changectx, path, data, islink=False, isexec=False, copysource=None: \
+        __org_memfilectx_(repo, changectx, path, data, islink=islink, isexec=isexec, copied=copysource)