diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-05-01 19:14:38 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-06-16 16:02:26 +0000 |
commit | 665ea01218dcba658d95b86014c7da5dd974a8a7 (patch) | |
tree | d9e5fa8598c5e64eaf6c609a109e3b889813dcb8 /morphlib/gitdir.py | |
parent | 3f030c900570392180ce9bf813e546579e908eb3 (diff) | |
download | morph-665ea01218dcba658d95b86014c7da5dd974a8a7.tar.gz |
Add DefinitionsRepo class
The intention is for this class to take over the from the Workspace and
SystemBranch classes. It allows Morph to load and parse definitions from
a Git repo, without requiring the user to run `morph checkout` or
`morph branch`: it can operate from any normal Git repository.
The class behaves differently when the Git repository is inside a Morph
system-branch checkout made with `morph branch` or `morph checkout`, to
avoid changing things under the feet of people who are used to those
commands.
Change-Id: I52a898efb9f6fb7f7e94c65b9ed38516bd51f49d
Diffstat (limited to 'morphlib/gitdir.py')
-rw-r--r-- | morphlib/gitdir.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/morphlib/gitdir.py b/morphlib/gitdir.py index 9cb62e3b..8716da16 100644 --- a/morphlib/gitdir.py +++ b/morphlib/gitdir.py @@ -425,7 +425,7 @@ class GitDirectory(object): ''' - def __init__(self, dirname, search_for_root=False): + def __init__(self, dirname, search_for_root=False, allow_missing=False): '''Set up a GitDirectory instance for the repository at 'dirname'. If 'search_for_root' is set to True, 'dirname' may point to a @@ -440,7 +440,8 @@ class GitDirectory(object): self.dirname = dirname self.config = Config(config_file=None, runcmd=self._runcmd) - self._ensure_is_git_repo() + if not allow_missing: + self._ensure_is_git_repo() def __str__(self): return self.dirname |