changeset 1128:2922f4881a04

util: add a method to load data from a file
author Sean Farley <sean.michael.farley@gmail.com>
date Fri, 23 Aug 2013 10:54:20 -0500
parents eaefb3413b87
children 063cae4e35af
files hgsubversion/util.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/util.py
+++ b/hgsubversion/util.py
@@ -152,6 +152,16 @@ def dump(data, file_path):
     pickle.dump(data, f)
     f.close()
 
+def load(file_path):
+    """pickle load some data from a path.
+    """
+    data = None
+    if os.path.exists(file_path):
+        f = open(file_path)
+        data = pickle.load(f)
+        f.close()
+    return data
+
 def parseurl(url, heads=[]):
     checkout = None
     svn_url, (_junk, heads) = hg.parseurl(url, heads)