Commit fb8cf9cc authored by Aravind Vasudevan's avatar Aravind Vasudevan Committed by LUCI CQ

Add --protocol-override to fetch.py

This CL adds a non-functional `--protocol` flag to fetch.py. This will be used in the follow-up CL to update fetching protocol.

Bug: 1322156
Change-Id: I7eeebb9993face20bb671d6942ee23fd04802d8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3609453Reviewed-by: 's avatarJoanna Wang <jojwang@chromium.org>
Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
parent e06e3077
......@@ -34,6 +34,7 @@ from distutils import spawn
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
DEFAULT_PROTOCOL = 'https'
#################################################
# Checkout class definitions.
......@@ -199,6 +200,12 @@ def handle_args(argv):
help='Perform shallow clones, don\'t fetch the full git history.')
parser.add_argument('--force', action='store_true', default=False,
help='(dangerous) Don\'t look for existing .gclient file.')
parser.add_argument(
'-p',
'--protocol-override',
type=str,
default=DEFAULT_PROTOCOL,
help='Protocol to use to fetch dependencies, defaults to https.')
parser.add_argument('config', type=str,
help="Project to fetch, e.g. chromium.")
......
......@@ -54,11 +54,12 @@ class TestUtilityFunctions(unittest.TestCase):
no_history=False,
force=False,
config='foo',
protocol_override='https',
props=[]), response)
response = fetch.handle_args([
'filename', '-n', '--dry-run', '--nohooks', '--no-history', '--force',
'foo', '--some-param=1', '--bar=2'
'--protocol-override', 'sso', 'foo', '--some-param=1', '--bar=2'
])
self.assertEqual(argparse.Namespace(
dry_run=True,
......@@ -66,6 +67,20 @@ class TestUtilityFunctions(unittest.TestCase):
no_history=True,
force=True,
config='foo',
protocol_override='sso',
props=['--some-param=1', '--bar=2']), response)
response = fetch.handle_args([
'filename', '-n', '--dry-run', '--nohooks', '--no-history', '--force',
'-p', 'sso', 'foo', '--some-param=1', '--bar=2'
])
self.assertEqual(argparse.Namespace(
dry_run=True,
nohooks=True,
no_history=True,
force=True,
config='foo',
protocol_override='sso',
props=['--some-param=1', '--bar=2']), response)
@mock.patch('os.path.exists', return_value=False)
......
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