From a34aadc39454bf7b83535b112697c6fa0bfb71e0 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 11 Nov 2014 15:30:48 +0000 Subject: Be more consistent that definitions-dir must be a Git repo If we create the definitions-dir we also initialise it as a Git repo, now. I also deleted a no-longer-needed hack. --- baserockimport/mainloop.py | 4 ++-- baserockimport/morphsetondisk.py | 16 ++-------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/baserockimport/mainloop.py b/baserockimport/mainloop.py index b0f124c..ddcd480 100644 --- a/baserockimport/mainloop.py +++ b/baserockimport/mainloop.py @@ -362,7 +362,7 @@ class ImportLoop(object): self._run_lorry(lorry) if os.path.exists(checkoutpath): - repo = GitDirectory(checkoutpath) + repo = morphlib.gitdir.GitDirectory(checkoutpath) repo.update_remotes() else: if already_lorried: @@ -370,7 +370,7 @@ class ImportLoop(object): 'Expected %s to exist, but will recreate it', checkoutpath) cliapp.runcmd(['git', 'clone', repopath, checkoutpath]) - repo = GitDirectory(checkoutpath) + repo = morphlib.gitdir.GitDirectory(checkoutpath) except cliapp.AppException as e: raise BaserockImportException(e.msg.rstrip()) diff --git a/baserockimport/morphsetondisk.py b/baserockimport/morphsetondisk.py index 565ad24..4aed940 100644 --- a/baserockimport/morphsetondisk.py +++ b/baserockimport/morphsetondisk.py @@ -41,24 +41,12 @@ class MorphologySetOnDisk(morphlib.morphset.MorphologySet): self.load_all_morphologies() else: os.makedirs(path) + morphlib.gitdir.init(path) def load_all_morphologies(self): logging.info('Loading all .morph files under %s', self.path) - class FakeGitDir(morphlib.gitdir.GitDirectory): - '''FIXME: Ugh - - This is here because the default constructor will search up the - directory heirarchy until it finds a '.git' directory, but that - may be totally the wrong place for our purpose: we don't have a - Git directory at all. - - ''' - def __init__(self, path): - self.dirname = path - self._config = {} - - gitdir = FakeGitDir(self.path) + gitdir = morphlib.gitdir.GitDirectory(self.path) finder = morphlib.morphologyfinder.MorphologyFinder(gitdir) for filename in (f for f in finder.list_morphologies() if not gitdir.is_symlink(f)): -- cgit v1.2.1