diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-28 14:32:27 +0000 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-28 14:32:27 +0000 |
commit | 18b7b113d5382688d87962e3427680a01f2b17f8 (patch) | |
tree | 0396721ec56f2b1d133b367ce3df3c0f76185362 | |
parent | e6a107661917817a903140f489a2cf49d7028490 (diff) | |
parent | f913feca5121f2cc8e63cbe0eba95928e94c8fcf (diff) | |
download | morph-18b7b113d5382688d87962e3427680a01f2b17f8.tar.gz |
Merge branch 'danielsilverstone/remote-artifact-cache-chat'
-rwxr-xr-x | morphlib/app.py | 9 | ||||
-rw-r--r-- | morphlib/morphologyfactory.py | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index accbb9e4..1cf794d9 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -267,6 +267,12 @@ class Morph(cliapp.Application): elif rrc is not None: try: absref, tree = rrc.resolve_ref(reponame, ref) + if absref is not None: + self.status(msg='Resolved %(reponame)s %(ref)s via remote ' + 'repo cache', + reponame=reponame, + ref=ref, + chatty=True) except: pass if absref is None: @@ -282,7 +288,8 @@ class Morph(cliapp.Application): def traverse_morphs(self, triplets, lrc, rrc, update=True, visit=lambda rn, rf, fn, arf, m: None): - morph_factory = morphlib.morphologyfactory.MorphologyFactory(lrc, rrc) + morph_factory = morphlib.morphologyfactory.MorphologyFactory(lrc, rrc, + self) queue = collections.deque(triplets) while queue: diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py index 64022394..a219ed9b 100644 --- a/morphlib/morphologyfactory.py +++ b/morphlib/morphologyfactory.py @@ -39,9 +39,14 @@ class MorphologyFactory(object): '''An way of creating morphologies which will provide a default''' - def __init__(self, local_repo_cache, remote_repo_cache=None): + def __init__(self, local_repo_cache, remote_repo_cache=None, app=None): self._lrc = local_repo_cache self._rrc = remote_repo_cache + self._app = app + + def status(self, *args, **kwargs): # pragma: no cover + if self._app is not None: + self._app.status(*args, **kwargs) def get_morphology(self, reponame, sha1, filename): @@ -54,6 +59,10 @@ class MorphologyFactory(object): elif self._rrc is not None: file_list = self._rrc.ls_tree(reponame, sha1) if filename in file_list: + self.status(msg="Retrieving %(reponame)s %(sha1)s %(filename)s" + " from the remote artifact cache.", + reponame=reponame, sha1=sha1, filename=filename, + chatty=True) text = self._rrc.cat_file(reponame, sha1, filename) else: raise NotcachedError(reponame) |