git cl comment: require explicit --codereview with -i|--issue flag.
R=agable@chromium.org,machenbach@chromium.org
BUG=698236
Change-Id: If79f938e457f176c47badd75f78ed4ecb764ec2d
Reviewed-on: https://chromium-review.googlesource.com/456700
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index b63639f..f65b60d 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4260,8 +4260,9 @@
"""Shows or posts review comments for any changelist."""
parser.add_option('-a', '--add-comment', dest='comment',
help='comment to add to an issue')
- parser.add_option('-i', dest='issue',
- help='review issue id (defaults to current issue)')
+ parser.add_option('-i', '--issue', dest='issue',
+ help='review issue id (defaults to current issue). '
+ 'If given, requires --rietveld or --gerrit')
parser.add_option('-j', '--json-file',
help='File to write JSON summary to')
auth.add_auth_options(parser)
@@ -4276,6 +4277,8 @@
issue = int(options.issue)
except ValueError:
DieWithError('A review issue id is expected to be a number')
+ if not options.forced_codereview:
+ parser.error('--gerrit or --rietveld is required if --issue is specified')
cl = Changelist(issue=issue,
# TODO(tandrii): remove 'rietveld' default.