summaryrefslogtreecommitdiff
path: root/buildstream/_context.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-07 19:14:44 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-07 20:44:37 +0900
commit7fdddf30992efb9f2a88686638f997208b01d0f2 (patch)
tree4ab5752c1d925978b55341f9f7e467fd7c5b1d67 /buildstream/_context.py
parent141484fc3b17d558d053ccb11de2d24c632f09a6 (diff)
downloadbuildstream-7fdddf30992efb9f2a88686638f997208b01d0f2.tar.gz
Silence messages from Source cache interrogation
Source interrogation usually involves calling out to host tools to quickly check if a given ref exists. This has however regressed over time when running `bst build --track`. This patch adds a new context manager to silence the messages, and silences messages while calling `Source.get_consistency()` Fixes #280
Diffstat (limited to 'buildstream/_context.py')
-rw-r--r--buildstream/_context.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py
index 332b2c020..3f5a4d62f 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -343,6 +343,19 @@ class Context():
self._message_handler(message, context=self)
return
+ # _silence()
+ #
+ # A context manager to silence messages, this behaves in
+ # the same way as the `silent_nested` argument of the
+ # Context._timed_activity() context manager: especially
+ # important messages will not be silenced.
+ #
+ @contextmanager
+ def _silence(self):
+ self._push_message_depth(True)
+ yield
+ self._pop_message_depth()
+
# _timed_activity()
#
# Context manager for performing timed activities and logging those