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

Unified Diff: git_cl.py

Issue 1880243003: git cl: add --gerrit and --rietveld options to force codereview. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@T200
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | tests/git_cl_test.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 5bb5fdf6f35a51ffda31002350c785bbee4077a4..19a0e138ba0f4f133408e1749d1de8c36f3ba7ee 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2507,6 +2507,29 @@ _CODEREVIEW_IMPLEMENTATIONS = {
}
+def _add_codereview_select_options(parser):
+ """Appends --gerrit and --rietveld options to force specific codereview."""
+ parser.codereview_group = optparse.OptionGroup(
+ parser, 'EXPERIMENTAL! Codereview override options')
+ parser.add_option_group(parser.codereview_group)
+ parser.codereview_group.add_option(
+ '--gerrit', action='store_true',
+ help='Force the use of Gerrit for codereview')
+ parser.codereview_group.add_option(
+ '--rietveld', action='store_true',
+ help='Force the use of Rietveld for codereview')
+
+
+def _process_codereview_select_options(parser, options):
+ if options.gerrit and options.rietveld:
+ parser.error('Options --gerrit and --rietveld are mutually exclusive')
+ options.forced_codereview = None
+ if options.gerrit:
+ options.forced_codereview = 'gerrit'
+ elif options.rietveld:
+ options.forced_codereview = 'rietveld'
+
+
class ChangeDescription(object):
"""Contains a parsed form of the change description."""
R_LINE = r'^[ \t]*(TBR|R)[ \t]*=[ \t]*(.*?)[ \t]*$'
@@ -3122,7 +3145,9 @@ def CMDissue(parser, args):
help='Lookup the branch(es) for the specified issues. If '
'no issues are specified, all branches with mapped '
'issues will be listed.')
+ _add_codereview_select_options(parser)
options, args = parser.parse_args(args)
+ _process_codereview_select_options(parser, options)
if options.reverse:
branches = RunGit(['for-each-ref', 'refs/heads',
@@ -3141,7 +3166,7 @@ def CMDissue(parser, args):
print 'Branch for issue number %s: %s' % (
issue, ', '.join(issue_branch_map.get(int(issue)) or ('None',)))
else:
- cl = Changelist()
+ cl = Changelist(codereview=options.forced_codereview)
if len(args) > 0:
try:
issue = int(args[0])
@@ -3485,7 +3510,9 @@ def CMDupload(parser, args):
orig_args = args
add_git_similarity(parser)
auth.add_auth_options(parser)
+ _add_codereview_select_options(parser)
(options, args) = parser.parse_args(args)
+ _process_codereview_select_options(parser, options)
auth_config = auth.extract_auth_config_from_options(options)
if git_common.is_dirty_git_tree('upload'):
@@ -3497,7 +3524,7 @@ def CMDupload(parser, args):
# For sanity of test expectations, do this otherwise lazy-loading *now*.
settings.GetIsGerrit()
- cl = Changelist(auth_config=auth_config)
+ cl = Changelist(auth_config=auth_config, codereview=options.forced_codereview)
return cl.CMDUpload(options, args, orig_args)
@@ -3981,10 +4008,12 @@ def CMDpatch(parser, args):
parser.add_option_group(group)
auth.add_auth_options(parser)
+ _add_codereview_select_options(parser)
(options, args) = parser.parse_args(args)
+ _process_codereview_select_options(parser, options)
auth_config = auth.extract_auth_config_from_options(options)
- cl = Changelist(auth_config=auth_config)
+ cl = Changelist(auth_config=auth_config, codereview=options.forced_codereview)
issue_arg = None
if options.reapply :
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | tests/git_cl_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698