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 @@ -53,7 +53,7 @@ class MercurialInMemoryChangeset(BaseInM # check if this path is added for node in self.added: if node.path == path: - return memfilectx(path=node.path, + return memfilectx(_repo, path=node.path, data=(node.content.encode('utf8') if not node.is_binary else node.content), islink=False, @@ -63,7 +63,7 @@ class MercurialInMemoryChangeset(BaseInM # or changed for node in self.changed: if node.path == path: - return memfilectx(path=node.path, + return memfilectx(_repo, 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,3 +32,11 @@ from mercurial.node import nullrev # those authnadlers are patched for python 2.6.5 bug an # infinit looping when given invalid resources from mercurial.url import httpbasicauthhandler, httpdigestauthhandler + +import inspect +# Mercurial 3.1 503bb3af70fe +if inspect.getargspec(memfilectx.__init__).args[1] != 'repo': + _org__init__=memfilectx.__init__ + def _memfilectx__init__(self, repo, *a, **b): + return _org__init__(self, *a, **b) + memfilectx.__init__ = _memfilectx__init__