Commit 42c7f667 authored by joi@chromium.org's avatar joi@chromium.org

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
parent afccd0a8
......@@ -1329,6 +1329,9 @@ def main(argv):
print >> sys.stderr, 'Got an exception'
print >> sys.stderr, str(e)
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:
if e.code != 500:
raise
......
......@@ -11,6 +11,7 @@ import breakpad
import gclient_utils
from scm import GIT
import third_party.upload
import trychange
......@@ -51,10 +52,14 @@ if __name__ == '__main__':
args.extend(['--rietveld_url', GetRietveldServerUrl()])
# Hack around a limitation in logging.
logging.getLogger().handlers = []
sys.exit(trychange.TryChange(
args, file_list=[], swallow_exception=False,
prog='git-try',
extra_epilog='\n'
'git-try will diff against your tracked branch and will '
'detect your rietveld\n'
'code review if you are using git-cl\n'))
try:
sys.exit(trychange.TryChange(
args, file_list=[], swallow_exception=False,
prog='git-try',
extra_epilog='\n'
'git-try will diff against your tracked branch and will '
'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."""
def testMembersChanged(self):
members = [
'EPILOG', 'EscapeDot', 'GIT', 'GuessVCS', 'GetMungedDiff',
'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PrintSuccess',
'SCM', 'SVN', 'TryChange', 'USAGE',
'breakpad', 'datetime', 'errno', 'gclient_utils', 'getpass', 'json',
'logging', 'optparse', 'os', 'posixpath', 're', 'scm', 'shutil', 'sys',
'tempfile', 'urllib',
'EPILOG', 'EscapeDot', 'GIT', 'GuessVCS', 'GetMungedDiff', 'HELP_STRING',
'InvalidScript', 'NoTryServerAccess', 'PrintSuccess', 'SCM', 'SVN',
'TryChange', 'USAGE',
'breakpad', 'datetime', 'errno', 'gcl', 'gclient_utils', 'getpass',
'json', 'logging', 'optparse', 'os', 'posixpath', 're', 'scm', 'shutil',
'sys', 'tempfile', 'urllib',
]
# If this test fails, you should add the relevant test.
self.compareMembers(trychange, members)
......
......@@ -33,6 +33,11 @@ try:
except ImportError:
pass
try:
import gcl
except ImportError:
gcl = None
import gclient_utils
import scm
......@@ -106,17 +111,21 @@ class SCM(object):
def GetCodeReviewSetting(self, key):
"""Returns a value for the given key for this repository.
Uses gcl-style settings from the repository."""
if self.codereview_settings is None:
self.codereview_settings = {}
settings_file = self.ReadRootFile(self.codereview_settings_file)
if settings_file:
for line in settings_file.splitlines():
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, '')
Uses gcl-style settings from the repository.
"""
if gcl:
return gcl.GetCodeReviewSetting(key)
else:
if self.codereview_settings is None:
self.codereview_settings = {}
settings_file = self.ReadRootFile(self.codereview_settings_file)
if settings_file:
for line in settings_file.splitlines():
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):
"""Set default settings based on the gcl-style settings from the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment