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