Mercurial > hgsubversion
changeset 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 | 4cdb0e95604f |
children | 91d685418490 |
files | hgsubversion/util.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
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=[]):