Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: gclient_utils.py

Issue 209393006: Add warning batching in gclient_utils (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Address comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:'):
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698