mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
+ drive-by imports cleanup DISABLE_THIRD_PARTY_CHECK=Migrating multiple scripts to py3 Bug: 1292013 Change-Id: I6d004c6fd54253cc3694cf02cfe94731c7d2146d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3484199 Reviewed-by: Alexander Schulze <alexschulze@chromium.org> Reviewed-by: Tim Van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Liviu Rau <liviurau@chromium.org>
75 lines
2.6 KiB
Python
Executable File
75 lines
2.6 KiB
Python
Executable File
#!/usr/bin/env vpython3
|
|
#
|
|
# Copyright 2019 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
"""
|
|
Update Chromium to ToT devtools-frontend.
|
|
"""
|
|
|
|
import argparse
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def parse_options(cli_args):
|
|
parser = argparse.ArgumentParser(
|
|
description='Roll dependencies from Chromium.')
|
|
parser.add_argument('chromium_dir', help='Chromium directory')
|
|
parser.add_argument('devtools_dir', help='DevTools directory')
|
|
parser.add_argument('reviewer', help='reviewer for the CL')
|
|
return parser.parse_args(cli_args)
|
|
|
|
def update(options):
|
|
# Update from upstream
|
|
subprocess.check_call(['git', 'fetch', 'origin'],
|
|
cwd=options.chromium_dir)
|
|
subprocess.check_call(['git', 'checkout', 'origin/main'],
|
|
cwd=options.chromium_dir)
|
|
subprocess.check_call(['git', 'fetch', 'origin'],
|
|
cwd=options.devtools_dir)
|
|
# Get commit hashes
|
|
new_rev = subprocess.check_output(['git', 'rev-parse', 'origin/master'],
|
|
cwd=options.devtools_dir).strip()
|
|
old_rev = subprocess.check_output(
|
|
['gclient', 'getdep', '--var=devtools_frontend_revision'],
|
|
cwd=options.chromium_dir).strip()
|
|
rev_range = '%s..%s' % (old_rev[0:10], new_rev[0:10])
|
|
# Create commit message
|
|
message = 'Update third_party/devtools-frontend %s' % rev_range
|
|
message = message + '\n\n'
|
|
message = message + 'https://chromium.googlesource.com/devtools/devtools-frontend/+log/'
|
|
message = message + rev_range
|
|
# Display changes
|
|
subprocess.check_call(['git', 'log', '--oneline', rev_range],
|
|
cwd=options.devtools_dir)
|
|
# Set deps
|
|
subprocess.check_call(
|
|
['gclient', 'setdep', '--var=devtools_frontend_revision=%s' % new_rev],
|
|
cwd=options.chromium_dir)
|
|
# Create commit
|
|
subprocess.check_call(['git', 'add', 'DEPS'], cwd=options.chromium_dir)
|
|
subprocess.check_call(
|
|
['git',
|
|
'checkout',
|
|
'-b',
|
|
'devtools_frontend_%s_%s' % (old_rev[0:5], new_rev[0:5])],
|
|
cwd=options.chromium_dir)
|
|
subprocess.check_call(['git', 'commit', '-m', message],
|
|
cwd=options.chromium_dir)
|
|
# Upload CL
|
|
subprocess.check_call(
|
|
['git',
|
|
'cl',
|
|
'upload',
|
|
'-m', message,
|
|
'--tbrs=%s' % options.reviewer,
|
|
'-c'],
|
|
cwd=options.chromium_dir)
|
|
subprocess.check_call(['git', 'cl', 'web'], cwd=options.chromium_dir)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
OPTIONS = parse_options(sys.argv[1:])
|
|
update(OPTIONS)
|