Left: | ||
Right: |
OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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() |
OLD | NEW |