summaryrefslogtreecommitdiff
path: root/morphlib/git.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-11-02 14:37:35 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-11-02 14:37:35 +0000
commitb45c93ff4d7029065ccd26cad3f69cf2f30461da (patch)
treea60b3544704cc656577eb7fba1f52d8a73caf173 /morphlib/git.py
parentb90aad231183b5bdf7116711f82c93201ce086c8 (diff)
downloadmorph-b45c93ff4d7029065ccd26cad3f69cf2f30461da.tar.gz
Always get all morphologies from git
Previously, we've been able to get morphs for strata and systems directly from files, with uncommitted changes. No more.
Diffstat (limited to 'morphlib/git.py')
-rw-r--r--morphlib/git.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/morphlib/git.py b/morphlib/git.py
index 69f8752e..14cba0e6 100644
--- a/morphlib/git.py
+++ b/morphlib/git.py
@@ -57,22 +57,12 @@ def get_commit_id(repo, ref):
return out.strip()
-def get_morph_text(repo, ref):
+def get_morph_text(repo, ref, filename):
'''Return a morphology from a git repository.'''
# FIXME: This implementation assumes a local repo.
scheme, netlock, path, params, query, frag = urlparse.urlparse(repo)
assert scheme == 'file'
-
ex = morphlib.execute.Execute(path, msg=logging.debug)
- out = ex.runv(['git', 'ls-tree', '--name-only', '-z', ref])
- names = [x for x in out.split('\0') if x]
- morphs = [x for x in names if x.endswith('.morph')]
- if len(morphs) == 0:
- raise NoMorphs(repo, ref)
- if len(morphs) > 1:
- raise TooManyMorphs(repo, ref, morphs)
- out = ex.runv(['git', 'cat-file', 'blob', '%s:%s' % (ref, morphs[0])])
-
- return morphs[0], out
+ return ex.runv(['git', 'cat-file', 'blob', '%s:%s' % (ref, filename)])