diff hgsubversion/util.py @ 1147:56f426d0261f

util: add resave bool parameter to load This parameter is needed as a stopgap so that tests can use the common util.load method without having to change the format of the file. It isn't used now but will be in upcoming patches.
author Sean Farley <sean.michael.farley@gmail.com>
date Tue, 18 Feb 2014 17:16:28 -0600
parents d2b4a65921fe
children 91d685418490
line wrap: on
line diff
--- a/hgsubversion/util.py
+++ b/hgsubversion/util.py
@@ -157,7 +157,7 @@ def dump(data, file_path):
     json.dump(_convert(data, _scrub), f)
     f.close()
 
-def load(file_path, default=None):
+def load(file_path, default=None, resave=True):
     """Deserialize some data from a path.
     """
     data = default
@@ -174,7 +174,8 @@ def load(file_path, default=None):
 
         # convert the file to json immediately
         f.close()
-        dump(data, file_path)
+        if resave:
+            dump(data, file_path)
     return data
 
 def parseurl(url, heads=[]):