From 665ea01218dcba658d95b86014c7da5dd974a8a7 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 1 May 2015 19:14:38 +0000 Subject: 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 --- morphlib/gitdir.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'morphlib/gitdir.py') 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 -- cgit v1.2.1