summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-04-15 12:59:12 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-04-15 15:43:45 +0000
commite787f8e2c9b5abd5b6405427cf17072d4b8e19c9 (patch)
treea44c918d2fa816efcf4d417505d820e6e27b03f8
parent94bb7c071b94f75453ed6da774046c490c79d92e (diff)
downloadmorph-e787f8e2c9b5abd5b6405427cf17072d4b8e19c9.tar.gz
Load morphologies from the definitions repo
Rather than using the repo given by a chunk or stratum in a stratum or system, always look for morphologies in the definitions repository. It is assumed that the repository of the first triplet given is the definitions repository. However, source creation must still use the repo and ref from the chunk or stratum itself, so make sure that this is still available to use.
-rw-r--r--morphlib/app.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 74707998..047af293 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -340,26 +340,35 @@ class Morph(cliapp.Application):
resolved_refs = {}
resolved_morphologies = {}
+ # assume that the first triplet is a morphology from the definitions
+ # repo, then load everything from there
+ morphs_repo, morphs_ref, _ = triplets[0]
+
while queue:
reponame, ref, filename = queue.popleft()
- update_repo = update and reponame not in updated_repos
+ update_repo = update and morphs_repo not in updated_repos
# Resolve the (repo, ref) reference, cache result.
- reference = (reponame, ref)
+ reference = (morphs_repo, morphs_ref)
if not reference in resolved_refs:
resolved_refs[reference] = self.resolve_ref(
- lrc, rrc, reponame, ref, update_repo)
+ lrc, rrc, morphs_repo, morphs_ref, update_repo)
absref, tree = resolved_refs[reference]
- updated_repos.add(reponame)
+ updated_repos.add(morphs_repo)
# Fetch the (repo, ref, filename) morphology, cache result.
- reference = (reponame, absref, filename)
+ reference = (morphs_repo, absref, filename)
if not reference in resolved_morphologies:
resolved_morphologies[reference] = \
- morph_factory.get_morphology(reponame, absref, filename)
+ morph_factory.get_morphology(morphs_repo, absref, filename)
morphology = resolved_morphologies[reference]
+ if reponame != morphs_repo or ref != morphs_ref:
+ update_repo = update and reponame not in updated_repos
+ absref, tree = self.resolve_ref(
+ lrc, rrc, reponame, ref, update_repo)
+ updated_repos.add(reponame)
visit(reponame, ref, filename, absref, tree, morphology)
if morphology['kind'] == 'cluster':
raise cliapp.AppException(