# HG changeset patch # User Mads Kiilerich # Date 2014-08-12 13:08:23 # Node ID 056d2fc1f93f1a11a71b3fbd36c2d6fae6681430 # Parent 18a96780b8b7a02f8a35edb883d47722f77022a1 mercurial: support Mercurial 3.1 after memfilectx.__init__ was changed in 503bb3af70fe 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__