Commit 8ef7ab25 authored by ukai@chromium.org's avatar ukai@chromium.org

Don't call settings.GetIsGerrit() before parser.parse_args()

settings.GetIsGerrit() would invoke logging.basicConfig() and
preemtps the basicConfig for verbose option in parser.parse_args.

R=maruel@chromium.org,ilevy@chromium.org
BUG=162600

Review URL: https://chromiumcodereview.appspot.com/11418171

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@169843 0039d316-1c4b-4281-b951-d872f2087c98
parent a78f7c02
......@@ -1245,12 +1245,15 @@ def CMDupload(parser, args):
help="Emulate Subversion's auto properties feature.")
parser.add_option('-c', '--use-commit-queue', action='store_true',
help='tell the commit queue to commit this patchset')
if settings.GetIsGerrit():
parser.add_option('--target_branch', dest='target_branch', default='master',
help='target branch to upload')
parser.add_option('--target_branch',
help='When uploading to gerrit, remote branch to '
'use for CL. Default: master')
add_git_similarity(parser)
(options, args) = parser.parse_args(args)
if options.target_branch and not settings.GetIsGerrit():
parser.error('Use --target_branch for non gerrit repository.')
# Print warning if the user used the -m/--message argument. This will soon
# change to -t/--title.
if options.message:
......
......@@ -126,7 +126,6 @@ class TestGitCl(TestCase):
'-M'+similarity, 'fake_ancestor_sha'],), '+dat')
return [
((['git', 'config', 'gerrit.host'],), ''),
((['git', 'config', 'rietveld.server'],), 'codereview.example.com'),
((['git', 'symbolic-ref', 'HEAD'],), 'master'),
similarity_call,
......@@ -149,6 +148,7 @@ class TestGitCl(TestCase):
'foo'),
((['git', 'config', 'user.email'],), 'me@example.com'),
stat_call,
((['git', 'config', 'gerrit.host'],), ''),
((['git', 'log', '--pretty=format:%s\n\n%b', 'fake_ancestor_sha..'],),
'desc\n'),
]
......@@ -433,7 +433,6 @@ class TestGitCl(TestCase):
@classmethod
def _gerrit_base_calls(cls):
return [
((['git', 'config', 'gerrit.host'],), 'gerrit.example.com'),
((['git', 'config', 'rietveld.server'],), 'codereview.example.com'),
((['git', 'symbolic-ref', 'HEAD'],), 'master'),
((['git', 'config', '--int', '--get',
......@@ -465,6 +464,7 @@ class TestGitCl(TestCase):
@staticmethod
def _gerrit_upload_calls(description, reviewers):
calls = [
((['git', 'config', 'gerrit.host'],), 'gerrit.example.com'),
((['git', 'log', '--pretty=format:%s\n\n%b', 'fake_ancestor_sha..'],),
description)
]
......
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