summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-11-11 15:30:48 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-11-11 15:36:21 +0000
commita34aadc39454bf7b83535b112697c6fa0bfb71e0 (patch)
treeb72be16395700aed75e2e64260bf20881429d1a5
parent1c6d16c6d7521b57486838d0de1f81eb9afddbdc (diff)
downloadimport-a34aadc39454bf7b83535b112697c6fa0bfb71e0.tar.gz
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.
-rw-r--r--baserockimport/mainloop.py4
-rw-r--r--baserockimport/morphsetondisk.py16
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)):