# HG changeset patch # User Sean Farley # Date 1392765388 21600 # Node ID 56f426d0261f679429615ff7a3b6fde4924de6f7 # Parent 4cdb0e95604f657fb49acca19600c0b048eb6795 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. diff --git a/hgsubversion/util.py b/hgsubversion/util.py --- 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=[]):