changeset 1218:68e6927fa387 stable

compathacks: add wrapper for memfilectx
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 02 Jun 2014 19:53:49 -0500
parents e4b737479302
children 656718fdd3be
files hgsubversion/compathacks.py
diffstat 1 files changed, 24 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/compathacks.py
+++ b/hgsubversion/compathacks.py
@@ -1,11 +1,27 @@
 """Functions to work around API changes inside Mercurial."""
 
 def branchset(repo):
-  """Return the set of branches present in a repo.
-
-  Works around branchtags() vanishing between 2.8 and 2.9.
-  """
-  try:
-    return set(repo.branchmap())
-  except AttributeError:
-    return set(repo.branchtags())
+    """Return the set of branches present in a repo.
+
+    Works around branchtags() vanishing between 2.8 and 2.9.
+    """
+    try:
+        return set(repo.branchmap())
+    except AttributeError:
+        return set(repo.branchtags())
+
+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)