diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-08-01 10:41:51 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-08-01 13:36:35 +0000 |
commit | 1eecb98389433aecd53f4d1c8fb9a9c2bc008df5 (patch) | |
tree | f1b673ed63c3678b8a55ab0d8633bdf5ff02f177 /morphlib | |
parent | d3868784c8340245ee846eac1826305bc1616a52 (diff) | |
download | morph-1eecb98389433aecd53f4d1c8fb9a9c2bc008df5.tar.gz |
Consolidate morphology writing code in plugin
As simple as it is to dump json files, it is convenient to use the
same function, so the format can be kept the same.
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 910022e0..e5c5fb44 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -155,11 +155,11 @@ class BranchAndMergePlugin(cliapp.Plugin): '''Make refs to chunks be absolute SHA-1s.''' app = self.app - cache = morphlib.util.new_repo_caches(self.app)[0] + cache = morphlib.util.new_repo_caches(app)[0] for filename in args: with open(filename) as f: - morph = json.load(f) + morph = morphlib.morph2.Morphology(f.read()) if morph['kind'] != 'stratum': app.status(msg='Not a stratum: %(filename)s', @@ -178,8 +178,7 @@ class BranchAndMergePlugin(cliapp.Plugin): repo = cache.get_repo(reponame) source['ref'] = repo.resolve_ref(ref) - with open(filename, 'w') as f: - json.dump(morph, f, indent=4, sort_keys=True) + self.write_morphology(filename, morph) def init(self, args): '''Initialize a mine.''' |