mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Add warning batching in gclient_utils
BUG= Review URL: https://codereview.chromium.org/209393006 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@258982 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -1052,7 +1052,7 @@ solutions = [
|
||||
scm = gclient_scm.CreateSCM(dep.url, self.root_dir, dep.name)
|
||||
actual_url = scm.GetActualRemoteURL()
|
||||
if actual_url and not scm.DoesRemoteURLMatch():
|
||||
print >> sys.stderr, ('''
|
||||
gclient_utils.AddWarning('''
|
||||
################################################################################
|
||||
################################### WARNING! ###################################
|
||||
################################################################################
|
||||
@@ -1957,6 +1957,8 @@ def Main(argv):
|
||||
except (gclient_utils.Error, subprocess2.CalledProcessError), e:
|
||||
print >> sys.stderr, 'Error: %s' % str(e)
|
||||
return 1
|
||||
finally:
|
||||
gclient_utils.PrintWarnings()
|
||||
|
||||
|
||||
if '__main__' == __name__:
|
||||
|
||||
@@ -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:'):
|
||||
|
||||
Reference in New Issue
Block a user