diff --git a/kallithea/lib/vcs/backends/hg/inmemory.py b/kallithea/lib/vcs/backends/hg/inmemory.py --- a/kallithea/lib/vcs/backends/hg/inmemory.py +++ b/kallithea/lib/vcs/backends/hg/inmemory.py @@ -52,7 +52,7 @@ class MercurialInMemoryChangeset(BaseInM # check if this path is added for node in self.added: if node.path == path: - return memfilectx(_repo, path=node.path, + return memfilectx(_repo, memctx, path=node.path, data=(node.content.encode('utf8') if not node.is_binary else node.content), islink=False, @@ -62,7 +62,7 @@ class MercurialInMemoryChangeset(BaseInM # or changed for node in self.changed: if node.path == path: - return memfilectx(_repo, path=node.path, + return memfilectx(_repo, memctx, path=node.path, data=(node.content.encode('utf8') if not node.is_binary else node.content), islink=False, diff --git a/kallithea/lib/vcs/utils/hgcompat.py b/kallithea/lib/vcs/utils/hgcompat.py --- a/kallithea/lib/vcs/utils/hgcompat.py +++ b/kallithea/lib/vcs/utils/hgcompat.py @@ -32,6 +32,15 @@ from mercurial.scmutil import revrange from mercurial.node import nullrev from mercurial.url import httpbasicauthhandler, httpdigestauthhandler + +# Mercurial 4.5 8a0cac20a1ad introduced an extra memctx changectx argument +# - introduce an optional wrapper factory that doesn't pass it on +import inspect +if inspect.getargspec(memfilectx.__init__).args[2] != 'changectx': + __org_memfilectx = memfilectx + memfilectx = lambda repo, changectx, *args, **kwargs: __org_memfilectx(repo, *args, **kwargs) + + # workaround for 3.3 94ac64bcf6fe and not calling largefiles reposetup correctly localrepository._lfstatuswriters = [lambda *msg, **opts: None] # 3.5 7699d3212994 added the invariant that repo.lfstatus must exist before hitting overridearchive diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ requirements = [ "URLObject==2.3.4", "Routes==1.13", "dulwich>=0.14.1", - "mercurial>=4.0,<4.5", + "mercurial>=4.0,<4.6", "decorator >= 3.3.2", "Paste >= 2.0.3, < 3.0", ]