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

Unified Diff: hgreview.py

Issue 29338144: Issue 3779, issue 3784 - Make sure review description isn't cut off and contains repository path (Closed)
Patch Set: Created March 11, 2016, 2:13 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
@@ -47,21 +47,42 @@ def review(ui, repo, *paths, **opts):
raise error.Abort('Ambiguous revision range, only one of --revision and --change can be specified.')
if opts.get('change'):
args.extend(['--rev', '{0}^:{0}'.format(opts['change'])])
elif opts.get('revision'):
args.extend(['--rev', opts['revision']])
else:
raise error.Abort('What should be reviewed? Either --revision or --change is required.')
- if not opts.get('title') and not opts.get('issue') and opts.get('change'):
- opts['title'] = repo[opts['change']].description()
+ if not opts.get('issue'):
+ # New issue, make sure title and message are set
+ if not opts.get('title') and opts.get('change'):
+ opts['title'] = repo[opts['change']].description()
+ if not opts.get('title'):
+ opts['title'] = ui.prompt('New review title: ', '')
+ if not opts['title'].strip():
+ raise error.Abort('No review title given.')
- if not opts.get('issue') and not opts.get('reviewers'):
- raise error.Abort('Please specify --reviewers for your new review.')
+ if not opts.get('message'):
+ opts['message'] = opts['title']
+
+ path = ui.config('paths', 'default-push') or ui.config('paths', 'default')
+ match = re.search(r'^(?:https://|ssh://hg@)(.*)', path);
Sebastian Noack 2016/03/11 14:56:22 No plain HTTP?
Wladimir Palant 2016/03/11 15:03:53 We don't support plain HTTP on hg.adblockplus.org.
+ if match:
+ opts['message'] = '{0}\n\nRepository: {1}'.format(
+ opts['message'].strip(),
+ 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.')
+
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'):
if opts.get(opt, ''):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld