Reuse gcl.py's code review settings when running [gcl try], as gcl is

smarter about finding the most appropriate settings file.

Before this change, I inadvertently did a [gcl try] on a chrome-internal
change (it was a trivial change and not really secret, so no harm done).
After this change, that won't be possible.

Also, change breakpad to not upload the exception that is thrown when 
the user fails to provide correct log-on credentials.

TEST=none
BUG=none


Review URL: http://codereview.chromium.org/3390013

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@61738 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
joi@chromium.org 15 years ago
parent afccd0a8f8
commit 42c7f66733

@ -1329,6 +1329,9 @@ def main(argv):
print >> sys.stderr, 'Got an exception' print >> sys.stderr, 'Got an exception'
print >> sys.stderr, str(e) print >> sys.stderr, str(e)
return 1 return 1
except upload.ClientLoginError, e:
print >> sys.stderr, 'Got an exception logging in to Rietveld'
print >> sys.stderr, str(e)
except urllib2.HTTPError, e: except urllib2.HTTPError, e:
if e.code != 500: if e.code != 500:
raise raise

@ -11,6 +11,7 @@ import breakpad
import gclient_utils import gclient_utils
from scm import GIT from scm import GIT
import third_party.upload
import trychange import trychange
@ -51,10 +52,14 @@ if __name__ == '__main__':
args.extend(['--rietveld_url', GetRietveldServerUrl()]) args.extend(['--rietveld_url', GetRietveldServerUrl()])
# Hack around a limitation in logging. # Hack around a limitation in logging.
logging.getLogger().handlers = [] logging.getLogger().handlers = []
sys.exit(trychange.TryChange( try:
args, file_list=[], swallow_exception=False, sys.exit(trychange.TryChange(
prog='git-try', args, file_list=[], swallow_exception=False,
extra_epilog='\n' prog='git-try',
'git-try will diff against your tracked branch and will ' extra_epilog='\n'
'detect your rietveld\n' 'git-try will diff against your tracked branch and will '
'code review if you are using git-cl\n')) 'detect your rietveld\n'
'code review if you are using git-cl\n'))
except third_party.upload.ClientLoginError, e:
print('Got an exception while trying to log in to Rietveld.')
print(str(e))

@ -40,12 +40,12 @@ class TryChangeUnittest(TryChangeTestsBase):
"""General trychange.py tests.""" """General trychange.py tests."""
def testMembersChanged(self): def testMembersChanged(self):
members = [ members = [
'EPILOG', 'EscapeDot', 'GIT', 'GuessVCS', 'GetMungedDiff', 'EPILOG', 'EscapeDot', 'GIT', 'GuessVCS', 'GetMungedDiff', 'HELP_STRING',
'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PrintSuccess', 'InvalidScript', 'NoTryServerAccess', 'PrintSuccess', 'SCM', 'SVN',
'SCM', 'SVN', 'TryChange', 'USAGE', 'TryChange', 'USAGE',
'breakpad', 'datetime', 'errno', 'gclient_utils', 'getpass', 'json', 'breakpad', 'datetime', 'errno', 'gcl', 'gclient_utils', 'getpass',
'logging', 'optparse', 'os', 'posixpath', 're', 'scm', 'shutil', 'sys', 'json', 'logging', 'optparse', 'os', 'posixpath', 're', 'scm', 'shutil',
'tempfile', 'urllib', 'sys', 'tempfile', 'urllib',
] ]
# If this test fails, you should add the relevant test. # If this test fails, you should add the relevant test.
self.compareMembers(trychange, members) self.compareMembers(trychange, members)

@ -33,6 +33,11 @@ try:
except ImportError: except ImportError:
pass pass
try:
import gcl
except ImportError:
gcl = None
import gclient_utils import gclient_utils
import scm import scm
@ -106,17 +111,21 @@ class SCM(object):
def GetCodeReviewSetting(self, key): def GetCodeReviewSetting(self, key):
"""Returns a value for the given key for this repository. """Returns a value for the given key for this repository.
Uses gcl-style settings from the repository.""" Uses gcl-style settings from the repository.
if self.codereview_settings is None: """
self.codereview_settings = {} if gcl:
settings_file = self.ReadRootFile(self.codereview_settings_file) return gcl.GetCodeReviewSetting(key)
if settings_file: else:
for line in settings_file.splitlines(): if self.codereview_settings is None:
if not line or line.lstrip().startswith('#'): self.codereview_settings = {}
continue settings_file = self.ReadRootFile(self.codereview_settings_file)
k, v = line.split(":", 1) if settings_file:
self.codereview_settings[k.strip()] = v.strip() for line in settings_file.splitlines():
return self.codereview_settings.get(key, '') if not line or line.lstrip().startswith('#'):
continue
k, v = line.split(":", 1)
self.codereview_settings[k.strip()] = v.strip()
return self.codereview_settings.get(key, '')
def _GclStyleSettings(self): def _GclStyleSettings(self):
"""Set default settings based on the gcl-style settings from the """Set default settings based on the gcl-style settings from the

Loading…
Cancel
Save