changeset 1198:b1a6edc78bfb

compathacks: add wrapper for memfilectx
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 02 Jun 2014 19:53:49 -0500
parents 1414cdafa7af
children 955f7173e498
files hgsubversion/compathacks.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/compathacks.py
+++ b/hgsubversion/compathacks.py
@@ -15,3 +15,14 @@ def pickle_load(f):
     import cPickle as pickle
     f.seek(0)
     return pickle.load(f)
+
+def makememfilectx(repo, path, data, islink, isexec, copied):
+    """Return a memfilectx
+
+    Works around memfilectx() adding a repo argument between 3.0 and 3.1.
+    """
+    from mercurial import context
+    try:
+        return context.memfilectx(repo, path, data, islink, isexec, copied)
+    except TypeError:
+        return context.memfilectx(path, data, islink, isexec, copied)