Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: hgreview.py

Issue 29363768: Fixes 4662 - [hgreview] Add an option for suppressing the email after upload (Closed) Base URL: https://bitbucket.org/fhd/codingtools
Patch Set: Use ui.status instead of print Created Nov. 23, 2016, 5:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: hgreview.py
===================================================================
--- a/hgreview.py
+++ b/hgreview.py
@@ -21,32 +21,34 @@
('c', 'change', '', 'A single revision to upload.', 'REV'),
('t', 'title', '', 'New review subject or new patch set title.', 'TITLE'),
('m', 'message', '', 'New review description or new patch set message.', 'MESSAGE'),
('w', 'reviewers', '', 'Add reviewers (comma separated email addresses or @adblockplus.org user names).', 'REVIEWERS'),
('', 'cc', '', 'Add CC (comma separated email addresses or @adblockplus.org user names).', 'CC'),
('', 'private', None, 'Make the review restricted to reviewers and those CCed.'),
('y', 'assume_yes', None, 'Assume that the answer to yes/no questions is \'yes\'.'),
('', 'print_diffs', None, 'Print full diffs.'),
+ ('', 'no_mail', None, 'Don\'t send an email after uploading.'),
], '[options] [path...]')
def review(ui, repo, *paths, **opts):
'''
Uploads a review to https://codereview.adblockplus.org/ or updates an
existing review request. This will always send mails for new reviews, when
updating a review mails will only be sent if a message is given.
'''
args = ['--oauth2', '--server', SERVER]
if ui.debugflag:
args.append('--noisy')
elif ui.verbose:
args.append('--verbose')
elif ui.quiet:
args.append('--quiet')
- if not opts.get('issue') or opts.get('message'):
+ if (not opts.get('no_mail') and
+ (not opts.get('issue') or opts.get('message'))):
args.append('--send_mail')
if opts.get('revision') and opts.get('change'):
raise error.Abort('Ambiguous revision range, only one of --revision and --change can be specified.')
if opts.get('change'):
rev = repo[opts['change']]
args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)])
elif opts.get('revision'):
@@ -70,19 +72,24 @@
or ui.config('paths', 'default')
or '')
match = re.search(r'^(?:https://|ssh://hg@)(.*)', path)
if match:
opts['base_url'] = 'https://' + match.group(1)
# Make sure there is at least one reviewer
if not opts.get('reviewers'):
- opts['reviewers'] = ui.prompt('Reviewers (comma-separated): ', '')
- if not opts['reviewers'].strip():
- raise error.Abort('No reviewers given.')
+ if opts.get('no_mail'):
+ ui.status('No reviewers specified, edit the review to add '
+ 'some.\n')
+ else:
+ opts['reviewers'] = ui.prompt('Reviewers (comma-separated): ',
+ '')
+ if not opts['reviewers'].strip():
+ raise error.Abort('No reviewers given.')
for opt in ('reviewers', 'cc'):
if opts.get(opt):
users = [u if '@' in u else u + '@adblockplus.org'
for u in re.split(r'\s*,\s*', opts[opt])]
opts[opt] = ','.join(users)
for opt in ('issue', 'title', 'message', 'reviewers', 'cc', 'base_url'):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld