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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import BaseHTTPServer 1 import BaseHTTPServer
2 import os 2 import os
3 import re 3 import re
4 import socket 4 import socket
5 import sys 5 import sys
6 import urllib 6 import urllib
7 7
8 from mercurial import cmdutil, error 8 from mercurial import cmdutil, error
9 9
10 SERVER = 'https://codereview.adblockplus.org' 10 SERVER = 'https://codereview.adblockplus.org'
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 if opts.get('revision') and opts.get('change'): 46 if opts.get('revision') and opts.get('change'):
47 raise error.Abort('Ambiguous revision range, only one of --revision and --ch ange can be specified.') 47 raise error.Abort('Ambiguous revision range, only one of --revision and --ch ange can be specified.')
48 if opts.get('change'): 48 if opts.get('change'):
49 args.extend(['--rev', '{0}^:{0}'.format(opts['change'])]) 49 args.extend(['--rev', '{0}^:{0}'.format(opts['change'])])
50 elif opts.get('revision'): 50 elif opts.get('revision'):
51 args.extend(['--rev', opts['revision']]) 51 args.extend(['--rev', opts['revision']])
52 else: 52 else:
53 raise error.Abort('What should be reviewed? Either --revision or --change is required.') 53 raise error.Abort('What should be reviewed? Either --revision or --change is required.')
54 54
55 if not opts.get('title') and not opts.get('issue') and opts.get('change'): 55 if not opts.get('issue'):
56 opts['title'] = repo[opts['change']].description() 56 # New issue, make sure title and message are set
57 if not opts.get('title') and opts.get('change'):
58 opts['title'] = repo[opts['change']].description()
59 if not opts.get('title'):
60 opts['title'] = ui.prompt('New review title: ', '')
61 if not opts['title'].strip():
62 raise error.Abort('No review title given.')
57 63
58 if not opts.get('issue') and not opts.get('reviewers'): 64 if not opts.get('message'):
59 raise error.Abort('Please specify --reviewers for your new review.') 65 opts['message'] = opts['title']
66
67 path = ui.config('paths', 'default-push') or ui.config('paths', 'default')
68 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.
69 if match:
70 opts['message'] = '{0}\n\nRepository: {1}'.format(
71 opts['message'].strip(),
72 match.group(1)
73 )
74
75 # Make sure there is at least one reviewer
76 if not opts.get('reviewers'):
77 opts['reviewers'] = ui.prompt('Reviewers (comma-separated): ', '')
78 if not opts['reviewers'].strip():
79 raise error.Abort('No reviewers given.')
80
60 for opt in ('reviewers', 'cc'): 81 for opt in ('reviewers', 'cc'):
61 if opts.get(opt): 82 if opts.get(opt):
62 users = [u if '@' in u else u + '@adblockplus.org' 83 users = [u if '@' in u else u + '@adblockplus.org'
63 for u in re.split(r'\s*,\s*', opts[opt])] 84 for u in re.split(r'\s*,\s*', opts[opt])]
64 opts[opt] = ','.join(users) 85 opts[opt] = ','.join(users)
65 86
66 for opt in ('issue', 'title', 'message', 'reviewers', 'cc'): 87 for opt in ('issue', 'title', 'message', 'reviewers', 'cc'):
67 if opts.get(opt, ''): 88 if opts.get(opt, ''):
68 args.extend(['--' + opt, opts[opt]]) 89 args.extend(['--' + opt, opts[opt]])
69 90
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 </body> 146 </body>
126 </html> 147 </html>
127 ''' % port 148 ''' % port
128 149
129 # Run the upload tool 150 # Run the upload tool
130 issue, patchset = scope['RealMain']([upload_path] + args) 151 issue, patchset = scope['RealMain']([upload_path] + args)
131 152
132 # Wait for the page to check in and retrieve issue URL 153 # Wait for the page to check in and retrieve issue URL
133 if server: 154 if server:
134 server.handle_request() 155 server.handle_request()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld