summaryrefslogtreecommitdiff
path: root/morphlib/cachedrepo.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/cachedrepo.py')
-rw-r--r--morphlib/cachedrepo.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/morphlib/cachedrepo.py b/morphlib/cachedrepo.py
index 827acf47..f0ca627b 100644
--- a/morphlib/cachedrepo.py
+++ b/morphlib/cachedrepo.py
@@ -188,6 +188,15 @@ class CachedRepo(object):
self._checkout_ref(ref, target_dir)
+ def load_morphology(self, ref, name):
+ '''Loads a morphology from a given ref'''
+
+ if not morphlib.git.is_valid_sha1(ref):
+ ref = self._rev_list(ref).strip()
+ text = self.cat(ref, '%s.morph' % name)
+ morphology = morphlib.morph2.Morphology(text)
+ return morphology
+
def ls_tree(self, ref):
'''Return file names found in root tree. Does not recurse to subtrees.