summaryrefslogtreecommitdiff
path: root/morphlib/morphologyfinder.py
Commit message (Collapse)AuthorAgeFilesLines
* Make MorphologyFinder use file pathsRichard Maw2014-07-071-15/+6
| | | | | | | | | | | | | | | | | | | | We want to use file paths to locate morphologies now, so the old model of get a list of names and hand it those back to get the contents doesn't really make sense any more. This abstraction initially came about as one idea I had for moving morphologies out of the source tree was to put them in something like git notes, where it's possible to look up information for one commit in another ref in the repository, at which point this abstraction would have been flexible enough to handle that as well as in the However, moving the chunk morphologies into the definitions repository has other benefits too, so it makes more sense to be honest about using filenames in the API. It remains as a single point where we can put the logic for knowing which files in a repository look like morphologies, but if we need to remove any further functionality, it should be replaced by a single function.
* morphlib: Add MorphologyFinder classRichard Maw2013-09-051-0/+71
MorphologyFinder is a small wrapper on top of GitDirectory that allows the inspection of morphologies in the repository. Its purpose is to isolate the logic for reading morphologies into one place. It is used by passing a GitDirectory and optionally a ref to the MorpholgyFinder constructor, then list_morphologies and read_morphology may be used. The ref is passed directly to the GitDirectory, so its semantics for a ref of None or omitted are used. i.e. It uses the working tree. Ref resolving is deferred until a morphology is listed or read, so it will not raise an exception for an invalid ref until then.