Chromium Code Reviews| Index: gclient_utils.py |
| diff --git a/gclient_utils.py b/gclient_utils.py |
| index 7003fc88676b49e79aba8acbd5f68bdd2cdb7fd3..febcf163104be250e13bd463b486c058be1a3ac6 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(): |
| + """Print any accumulated warnings.""" |
|
M-A Ruel
2014/03/24 17:53:06
Prints
borenet
2014/03/24 18:01:48
Done.
|
| + if _WARNINGS: |
| + print >> sys.stderr, '\n\nWarnings:' |
| + for warning in _WARNINGS: |
| + print >> sys.stderr, warning |
| + |
| + |
| +def AddWarning(msg): |
| + """Add the given warning message to the list of accumulated warnings.""" |
|
M-A Ruel
2014/03/24 17:53:06
Adds
borenet
2014/03/24 18:01:48
Done.
|
| + _WARNINGS.append(msg) |
|
M-A Ruel
2014/03/24 17:53:06
In theory you'd need a lock. In practice, it's not
borenet
2014/03/24 18:01:48
My understanding is that list.append is thread-saf
|
| + |
| + |
| def SplitUrlRevision(url): |
| """Splits url and returns a two-tuple: url, rev""" |
| if url.startswith('ssh:'): |