changeset 1140:9ec3c2e89c94

util: banish pickle to compathacks
author Sean Farley <sean.michael.farley@gmail.com>
date Sat, 15 Feb 2014 01:58:07 -0600
parents d1bd52202c6d
children a4b54b19cd2e
files hgsubversion/compathacks.py hgsubversion/util.py
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/compathacks.py
+++ b/hgsubversion/compathacks.py
@@ -10,3 +10,8 @@ def branchset(repo):
         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)
--- a/hgsubversion/util.py
+++ b/hgsubversion/util.py
@@ -1,4 +1,4 @@
-import cPickle as pickle
+import compathacks
 import errno
 import re
 import os
@@ -192,8 +192,7 @@ def load(file_path):
         f.close()
     except ValueError:
         # Ok, JSON couldn't be loaded, so we'll try the old way of using pickle
-        f.seek(0)
-        data = pickle.load(f)
+        data = compathacks.pickle_load(f)
 
         # convert the file to json immediately
         f.close()