diff options
-rw-r--r-- | morphlib/plugins/branch_and_merge_new_plugin.py | 11 | ||||
-rw-r--r-- | morphlib/sysbranchdir.py | 14 | ||||
-rw-r--r-- | morphlib/util.py | 1 |
3 files changed, 16 insertions, 10 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 8ad9effd..3a3c1d1b 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -615,15 +615,8 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): '''Read in all the morphologies in the root repository.''' self.app.status(msg='Loading in all morphologies') morphs = morphlib.morphset.MorphologySet() - mf = morphlib.morphologyfinder.MorphologyFinder( - morphlib.gitdir.GitDirectory( - sb.get_git_directory_name(sb.root_repository_url))) - for morph in mf.list_morphologies(): - text, filename = mf.read_morphology(morph) - m = loader.load_from_string(text, filename=filename) - m.repo_url = sb.root_repository_url - m.ref = sb.system_branch_name - morphs.add_morphology(m) + for morph in sb.load_all_morphologies(loader): + morphs.add_morphology(morph) return morphs def petrify(self, args): diff --git a/morphlib/sysbranchdir.py b/morphlib/sysbranchdir.py index 73a07d5e..1a8b898a 100644 --- a/morphlib/sysbranchdir.py +++ b/morphlib/sysbranchdir.py @@ -161,6 +161,20 @@ class SystemBranchDirectory(object): for dirname in morphlib.util.find_leaves(self.root_directory, '.git')) + # Not covered by unit tests, since testing the functionality spans + # multiple modules and only tests useful output with a full system + # branch, so it is instead covered by integration tests. + def load_all_morphologies(self, loader): # pragma: no cover + gd_name = self.get_git_directory_name(self.root_repository_url) + gd = morphlib.gitdir.GitDirectory(gd_name) + mf = morphlib.morphologyfinder.MorphologyFinder(gd) + for morph in mf.list_morphologies(): + text, filename = mf.read_morphology(morph) + m = loader.load_from_string(text, filename=filename) + m.repo_url = self.root_repository_url + m.ref = self.system_branch_name + yield m + def create(root_directory, root_repository_url, system_branch_name): '''Create a new system branch directory on disk. diff --git a/morphlib/util.py b/morphlib/util.py index 7382e40c..16e56366 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -18,7 +18,6 @@ import os import re import morphlib -import logging '''Utility functions for morph.''' |