Index: gclient_utils.py |
diff --git a/gclient_utils.py b/gclient_utils.py |
index 7003fc88676b49e79aba8acbd5f68bdd2cdb7fd3..44dba57df2f8230c247e3bbf96eee5c58e61448c 100644 |
--- a/gclient_utils.py |
+++ b/gclient_utils.py |
@@ -27,6 +27,9 @@ RETRY_MAX = 3 |
RETRY_INITIAL_SLEEP = 0.5 |
+_WARNINGS = [] |
+ |
+ |
class Error(Exception): |
"""gclient exception class.""" |
def __init__(self, msg, *args, **kwargs): |
@@ -36,6 +39,19 @@ class Error(Exception): |
super(Error, self).__init__(msg, *args, **kwargs) |
+def PrintWarnings(): |
+ """Prints any accumulated warnings.""" |
+ if _WARNINGS: |
+ print >> sys.stderr, '\n\nWarnings:' |
+ for warning in _WARNINGS: |
+ print >> sys.stderr, warning |
+ |
+ |
+def AddWarning(msg): |
+ """Adds the given warning message to the list of accumulated warnings.""" |
+ _WARNINGS.append(msg) |
+ |
+ |
def SplitUrlRevision(url): |
"""Splits url and returns a two-tuple: url, rev""" |
if url.startswith('ssh:'): |