diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-09-26 11:20:34 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-09-26 11:21:09 +0000 |
commit | 151050c5b15e83cbfc6ac9fcd786dcb957022185 (patch) | |
tree | c3da24c1a3d3b2f2f76fb7c012cd7149d8729262 /morphlib | |
parent | 6a216934edb2423c9aa347329ea029041927a413 (diff) | |
download | morph-151050c5b15e83cbfc6ac9fcd786dcb957022185.tar.gz |
Make branch commands work with null refs
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/morphset.py | 8 | ||||
-rw-r--r-- | morphlib/plugins/branch_and_merge_new_plugin.py | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/morphlib/morphset.py b/morphlib/morphset.py index 3c07d58e..9ef1e804 100644 --- a/morphlib/morphset.py +++ b/morphlib/morphset.py @@ -95,9 +95,11 @@ class MorphologySet(object): repo_url, ref, morph = self._find_spec( system_morph['strata'], stratum_name) - if repo_url is None: + if (repo_url, ref, morph) == (None, None, None): raise StratumNotInSystemError(system_morph['name'], stratum_name) - m = self._get_morphology(repo_url, ref, '%s.morph' % morph) + m = self._get_morphology(repo_url or system_morph.repo_url, + ref or system_morph.ref, + '%s.morph' % morph) if m is None: raise StratumNotInSetError(stratum_name) return m @@ -118,7 +120,7 @@ class MorphologySet(object): repo_url, ref, morph = self._find_spec( stratum_morph['chunks'], chunk_name) - if repo_url is None: + if (repo_url, ref, morph) == (None, None, None): raise ChunkNotInStratumError(stratum_morph['name'], chunk_name) return repo_url, ref, morph diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 39552ef0..edda7d9c 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -266,7 +266,9 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): # of triplets (repo url, ref, filename). return [ - (spec['repo'], spec['ref'], '%s.morph' % spec['morph']) + (spec['repo'] or morph.repo_url, + spec['ref'] or morph.ref, + '%s.morph' % spec['morph']) for spec in specs ] @@ -679,6 +681,9 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): #TODO: Stop using app.resolve_ref def resolve_refs(morphs): for repo, ref in morphs.list_refs(): + # You can't resolve null refs, so don't attempt to. + if repo is None or ref is None: + continue # TODO: Handle refs that are only in workspace in general if (repo == sb.root_repository_url and ref == sb.system_branch_name): |