summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-28 14:07:07 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-28 14:07:07 +0000
commitf913feca5121f2cc8e63cbe0eba95928e94c8fcf (patch)
tree8debcf8b27808ec7818dce820d3370aab5f6fe60 /morphlib
parent1087f571c7cd7c18d2984df3cc90c87410c55bb2 (diff)
downloadmorph-f913feca5121f2cc8e63cbe0eba95928e94c8fcf.tar.gz
Increase verbosity regarding the remote artifact cache.
This simply increases the verbosity of the operations which are done against the remote artifact cache. It should result in some progress messages if you build with --verbose set and you're mostly getting stuff from your remote artifact cache (Trove).
Diffstat (limited to 'morphlib')
-rwxr-xr-xmorphlib/app.py9
-rw-r--r--morphlib/morphologyfactory.py11
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)