diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-10-02 14:58:48 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-10-03 14:40:37 +0100 |
commit | 9c2ccea87da3809082a1fa392611cc5294f717fe (patch) | |
tree | a9aecb9a4d234a45ea1de0976ab8eedac6cf19fd /morphlib/cachedrepo.py | |
parent | 8bcb622e182d49d143af417bd3d0a64d4188356b (diff) | |
download | morph-9c2ccea87da3809082a1fa392611cc5294f717fe.tar.gz |
Use repository cache for git access other than current system branch
The origin/ refs in the system branch checkout repos may or may not be
up to date, and may or may not have been tampered with by the user.
Much better to use our central cache for everything other than changes
to the system branch ref itself, where we should indeed be honouring
the user's local changes.
At a later date we could warn if the user modifies refs other than
the system branch ref but does not push, as these changes will have no
effect.
NOTE: this commit breaks 'morph merge'. It is fixed in the next commit.
Diffstat (limited to 'morphlib/cachedrepo.py')
-rw-r--r-- | morphlib/cachedrepo.py | 9 |
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. |