Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: git_cl.py

Issue 1053653004: Add ability to CQ dry run patchsets during "git cl upload" (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Cleanup Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/upload.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 remote, remote_branch = cl.GetRemoteBranch() 1933 remote, remote_branch = cl.GetRemoteBranch()
1934 target_ref = GetTargetRef(remote, remote_branch, options.target_branch, 1934 target_ref = GetTargetRef(remote, remote_branch, options.target_branch,
1935 settings.GetPendingRefPrefix()) 1935 settings.GetPendingRefPrefix())
1936 if target_ref: 1936 if target_ref:
1937 upload_args.extend(['--target_ref', target_ref]) 1937 upload_args.extend(['--target_ref', target_ref])
1938 1938
1939 project = settings.GetProject() 1939 project = settings.GetProject()
1940 if project: 1940 if project:
1941 upload_args.extend(['--project', project]) 1941 upload_args.extend(['--project', project])
1942 1942
1943 if options.cq_dry_run:
1944 upload_args.extend(['--cq_dry_run'])
1945
1943 try: 1946 try:
1944 upload_args = ['upload'] + upload_args + args 1947 upload_args = ['upload'] + upload_args + args
1945 logging.info('upload.RealMain(%s)', upload_args) 1948 logging.info('upload.RealMain(%s)', upload_args)
1946 issue, patchset = upload.RealMain(upload_args) 1949 issue, patchset = upload.RealMain(upload_args)
1947 issue = int(issue) 1950 issue = int(issue)
1948 patchset = int(patchset) 1951 patchset = int(patchset)
1949 except KeyboardInterrupt: 1952 except KeyboardInterrupt:
1950 sys.exit(1) 1953 sys.exit(1)
1951 except: 1954 except:
1952 # If we got an exception after the user typed a description for their 1955 # If we got an exception after the user typed a description for their
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 '--target-branch', 2016 '--target-branch',
2014 metavar='TARGET', 2017 metavar='TARGET',
2015 help='Apply CL to remote ref TARGET. ' + 2018 help='Apply CL to remote ref TARGET. ' +
2016 'Default: remote branch head, or master') 2019 'Default: remote branch head, or master')
2017 parser.add_option('--squash', action='store_true', 2020 parser.add_option('--squash', action='store_true',
2018 help='Squash multiple commits into one (Gerrit only)') 2021 help='Squash multiple commits into one (Gerrit only)')
2019 parser.add_option('--email', default=None, 2022 parser.add_option('--email', default=None,
2020 help='email address to use to connect to Rietveld') 2023 help='email address to use to connect to Rietveld')
2021 parser.add_option('--tbr-owners', dest='tbr_owners', action='store_true', 2024 parser.add_option('--tbr-owners', dest='tbr_owners', action='store_true',
2022 help='add a set of OWNERS to TBR') 2025 help='add a set of OWNERS to TBR')
2026 parser.add_option('--cq-dry-run', dest='cq_dry_run', action='store_true',
2027 help='Send the patchset to do a CQ dry run right after '
2028 'upload.')
2023 2029
2024 add_git_similarity(parser) 2030 add_git_similarity(parser)
2025 (options, args) = parser.parse_args(args) 2031 (options, args) = parser.parse_args(args)
2026 2032
2027 if is_dirty_git_tree('upload'): 2033 if is_dirty_git_tree('upload'):
2028 return 1 2034 return 1
2029 2035
2030 options.reviewers = cleanup_list(options.reviewers) 2036 options.reviewers = cleanup_list(options.reviewers)
2031 options.cc = cleanup_list(options.cc) 2037 options.cc = cleanup_list(options.cc)
2032 2038
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
3134 if __name__ == '__main__': 3140 if __name__ == '__main__':
3135 # These affect sys.stdout so do it outside of main() to simplify mocks in 3141 # These affect sys.stdout so do it outside of main() to simplify mocks in
3136 # unit testing. 3142 # unit testing.
3137 fix_encoding.fix_encoding() 3143 fix_encoding.fix_encoding()
3138 colorama.init() 3144 colorama.init()
3139 try: 3145 try:
3140 sys.exit(main(sys.argv[1:])) 3146 sys.exit(main(sys.argv[1:]))
3141 except KeyboardInterrupt: 3147 except KeyboardInterrupt:
3142 sys.stderr.write('interrupted\n') 3148 sys.stderr.write('interrupted\n')
3143 sys.exit(1) 3149 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | third_party/upload.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698