changeset 4420:056d2fc1f93f

mercurial: support Mercurial 3.1 after memfilectx.__init__ was changed in 503bb3af70fe
author Mads Kiilerich <madski@unity3d.com>
date Tue, 12 Aug 2014 13:08:23 +0200
parents 18a96780b8b7
children 426427c406ff
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	Wed Jul 16 01:06:15 2014 +0200
+++ b/kallithea/lib/vcs/backends/hg/inmemory.py	Tue Aug 12 13:08:23 2014 +0200
@@ -53,7 +53,7 @@
             # 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 @@
             # 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,
--- a/kallithea/lib/vcs/utils/hgcompat.py	Wed Jul 16 01:06:15 2014 +0200
+++ b/kallithea/lib/vcs/utils/hgcompat.py	Tue Aug 12 13:08:23 2014 +0200
@@ -32,3 +32,11 @@
 # 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__