summaryrefslogtreecommitdiff
path: root/morphlib/blobs.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-19 15:32:58 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-20 18:31:51 +0000
commitc73ca82e0c67ba3d05f47f61766f8838d0e9d8d4 (patch)
treefb3fb2f063af4167da1c287d67e4ae2d818e7748 /morphlib/blobs.py
parent55751d6de5927c3bbcdd21321f7c3a6655e87a76 (diff)
downloadmorph-c73ca82e0c67ba3d05f47f61766f8838d0e9d8d4.tar.gz
Port everything to using Treeish objects instead of (repo, ref).
This affects pretty much every part of morph, so this might not be fully working and stable yet. This commit also introduces the "update-gits" command that can be used to update all cached repositories from the list of base URLs. The tree walk when resolving the Treeish objects in Builder.get_cache_id() is a bit similar to what we do in BuildDependencyGraph, maybe we can merge that one day.
Diffstat (limited to 'morphlib/blobs.py')
-rw-r--r--morphlib/blobs.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/morphlib/blobs.py b/morphlib/blobs.py
index 1732f000..d02643a6 100644
--- a/morphlib/blobs.py
+++ b/morphlib/blobs.py
@@ -14,8 +14,23 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import os
+
+
class Blob(object):
+ @staticmethod
+ def create_blob(morph):
+ if morph.kind == 'stratum':
+ return Stratum(morph)
+ elif morph.kind == 'chunk':
+ return Chunk(morph)
+ elif morph.kind == 'system':
+ return System(morph)
+ else:
+ raise TypeError('Morphology %s has an unknown type: %s' %
+ (morph.filename, morph.kind))
+
def __init__(self, morph):
self.parents = []
self.morph = morph