summaryrefslogtreecommitdiff
path: root/morphlib/source.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-04-18 10:52:39 +0100
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-04-18 13:34:25 +0100
commitad31f7608febab04157e015a90f5047a6f0d8d83 (patch)
tree0ac0885cd6e77783a0251ed67ad03f3834679d00 /morphlib/source.py
parent48732135d4536880e5459e3064cce9cfa63d6abe (diff)
downloadmorph-ad31f7608febab04157e015a90f5047a6f0d8d83.tar.gz
Add a repo_name to Source, use that instead of repo in most places.
This is because we will need to integrate a RemoteRepoCache and we don't always want to create a CachedRepo object (in fact, we only want that for the sources of artifacts we actually need to build). So we'll use either the local or the remote repo cache to resolve refs and morphology texts and then later, when actually caching a repo, we'll set the source.repo member to a CachedRepo object that we can then use to unpack the sources.
Diffstat (limited to 'morphlib/source.py')
-rw-r--r--morphlib/source.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/morphlib/source.py b/morphlib/source.py
index dc535a55..ff440f0b 100644
--- a/morphlib/source.py
+++ b/morphlib/source.py
@@ -24,6 +24,7 @@ class Source(object):
Has the following properties:
* ``repo`` -- the git repository which contains the source
+ * ``repo_name`` -- name of the git repository which contains the source
* ``original_ref`` -- the git ref provided by the user or a morphology
* ``sha1`` -- the absolute git commit id for the revision we use
* ``morphology`` -- the in-memory representation of the morphology we use
@@ -36,9 +37,10 @@ class Source(object):
'''
- def __init__(self, repo, original_ref, sha1, morphology, filename):
+ def __init__(self, repo_name, original_ref, sha1, morphology, filename):
assert isinstance(morphology, morphlib.morph2.Morphology)
- self.repo = repo
+ self.repo = None
+ self.repo_name = repo_name
self.original_ref = original_ref
self.sha1 = sha1
self.morphology = morphology
@@ -57,6 +59,6 @@ class Source(object):
return source in self.dependencies
def __str__(self): # pragma: no cover
- return '%s|%s|%s' % (self.repo.original_name,
+ return '%s|%s|%s' % (self.repo_name,
self.original_ref,
self.filename)