summaryrefslogtreecommitdiff
path: root/morphlib/buildbranch.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/buildbranch.py')
-rw-r--r--morphlib/buildbranch.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/morphlib/buildbranch.py b/morphlib/buildbranch.py
index e16bf2b4..6cec97fb 100644
--- a/morphlib/buildbranch.py
+++ b/morphlib/buildbranch.py
@@ -159,27 +159,31 @@ class BuildBranch(object):
sha1 = gd.store_blob(loader.save_to_string(morphology))
yield 0o100644, sha1, morphology.filename
+ def get_morphology_loader(self):
+ if self._sb:
+ return self._sb.get_morphology_loader()
+ else:
+ return self._root.get_morphology_loader()
+
def load_all_morphologies(self, loader):
if self._sb:
- return self._sb.load_all_morphologies(loader)
+ return self._sb.load_all_morphologies()
else:
- return self._root.load_all_morphologies(loader)
+ return self._root.load_all_morphologies()
- def inject_build_refs(self, loader, use_local_repos,
- inject_cb=lambda **kwargs: None):
+ def inject_build_refs(self, use_local_repos, inject_cb=lambda **kwargs:
+ None):
'''Update system and stratum morphologies to point to our branch.
For all edited repositories, this alter the temporary GitIndex
of the morphs repositories to point their temporary build branch
versions.
- `loader` is a MorphologyLoader that is used to convert morphology
- files into their in-memory representations and back again.
-
'''
root_repo = self._root.remote_url
root_ref = self._root.HEAD
morphs = morphlib.morphset.MorphologySet()
+ loader = self.get_morphology_loader()
for morph in self.load_all_morphologies(loader):
morphs.add_morphology(morph)
@@ -362,7 +366,7 @@ class BuildBranch(object):
@contextlib.contextmanager
-def pushed_build_branch(bb, loader, changes_need_pushing, name, email,
+def pushed_build_branch(bb, changes_need_pushing, name, email,
build_uuid, status):
with contextlib.closing(bb) as bb:
def report_add(gd, build_ref, changed):
@@ -385,8 +389,7 @@ def pushed_build_branch(bb, loader, changes_need_pushing, name, email,
status(msg='Injecting temporary build refs '\
'into morphologies in %(dirname)s',
dirname=gd.dirname, chatty=True)
- bb.inject_build_refs(loader=loader,
- use_local_repos=not changes_need_pushing,
+ bb.inject_build_refs(use_local_repos=not changes_need_pushing,
inject_cb=report_inject)
def report_commit(gd, build_ref):