diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-09-19 11:05:10 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-09-24 10:35:14 +0000 |
commit | b26aaa04c61ca93b6b8b89b0bd693723f4339b42 (patch) | |
tree | 3a52663dd58649b54bc2989bcab2505c642dfe15 | |
parent | e59d4347f511412e2162d97eca3fc65bf1c3b978 (diff) | |
download | morph-b26aaa04c61ca93b6b8b89b0bd693723f4339b42.tar.gz |
b&m: Refactor petrify to use new morphset methods
-rw-r--r-- | morphlib/plugins/branch_and_merge_new_plugin.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 7710f309..4329e0c2 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -673,29 +673,24 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): loader = morphlib.morphloader.MorphologyLoader() lrc, rrc = morphlib.util.new_repo_caches(self.app) update_repos = not self.app.settings['no-git-update'] - done = set() morphs = self._load_all_sysbranch_morphologies(sb, loader) - # Petrify the ref to each stratum and chunk. - def petrify_specs(specs): - for spec in specs: - ref = spec['ref'] - # Do not double petrify refs - if morphlib.git.is_valid_sha1(ref): + #TODO: Stop using app.resolve_ref + def resolve_refs(morphs): + for repo, ref in morphs.list_refs(): + # TODO: Handle refs that are only in workspace in general + if (repo == sb.root_repository_url + and ref == sb.system_branch_name): continue commit_sha1, tree_sha1 = self.app.resolve_ref( - lrc, rrc, spec['repo'], ref, update=update_repos) - assert 'name' in spec or 'morph' in spec - filename = '%s.morph' % spec.get('morph', spec.get('name')) - morphs.change_ref(spec['repo'], ref, filename, commit_sha1) + lrc, rrc, repo, ref, update=update_repos) + yield ((repo, ref), commit_sha1) - for m in morphs.morphologies: - if m['kind'] == 'system': - petrify_specs(m['strata']) - elif m['kind'] == 'stratum': - petrify_specs(m['build-depends']) - petrify_specs(m['chunks']) + morphs.repoint_refs(sb.root_repository_url, + sb.system_branch_name) + + morphs.petrify_chunks(dict(resolve_refs(morphs))) # Write morphologies back out again. self._save_dirty_morphologies(loader, sb, morphs.morphologies) |