diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-19 13:49:03 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-19 13:49:03 +0000 |
commit | 96143d48f432d08be650ea69cbd56cb50988e855 (patch) | |
tree | 2bc12320bf83bcd84f52452dd87a3d0ef0b1c5ed | |
parent | 9a08e558f6493cb2e4b664dab797270300c80caa (diff) | |
download | morph-96143d48f432d08be650ea69cbd56cb50988e855.tar.gz |
Document get_treeish() of the SourceManager.
-rw-r--r-- | morphlib/git.py | 3 | ||||
-rw-r--r-- | morphlib/sourcemanager.py | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/morphlib/git.py b/morphlib/git.py index 7654e3bd..2cde8c55 100644 --- a/morphlib/git.py +++ b/morphlib/git.py @@ -70,8 +70,7 @@ class Treeish: try: binascii.unhexlify(ref) ex = morphlib.execute.Execute(self.repo, self.msg) - # TODO why is refs unused here? can we remove it? - refs = ex.runv(['git', 'rev-list', '--no-walk', ref]) + ex.runv(['git', 'rev-list', '--no-walk', ref]) self.sha1=ref except (TypeError, morphlib.execute.CommandFailure): raise InvalidTreeish(self.repo,ref) diff --git a/morphlib/sourcemanager.py b/morphlib/sourcemanager.py index fd2ce71d..f78b8cd6 100644 --- a/morphlib/sourcemanager.py +++ b/morphlib/sourcemanager.py @@ -104,6 +104,16 @@ class SourceManager(object): ex.runv(['wget', '-c', url]) def get_treeish(self, repo, ref): + '''Returns a Treeish for a URL or repo name with a given reference. + + If the source hasn't been cloned yet, this will fetch it, either using + clone or by fetching a bundle. + + Raises morphlib.git.InvalidTreeish if the reference cannot be found. + Raises morphlib.sourcemanager.SourceNotFound if source cannot be found. + + ''' + self.msg('checking cache for git %s|%s' % (repo, ref)) #TODO is it actually an error to have no base url? |