| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 raise error.Abort('No review title given.') | 63 raise error.Abort('No review title given.') |
| 64 | 64 |
| 65 if not opts.get('message'): | 65 if not opts.get('message'): |
| 66 opts['message'] = opts['title'] | 66 opts['message'] = opts['title'] |
| 67 | 67 |
| 68 path = (ui.config('paths', 'default-push') | 68 path = (ui.config('paths', 'default-push') |
| 69 or ui.config('paths', 'default') | 69 or ui.config('paths', 'default') |
| 70 or '') | 70 or '') |
| 71 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) | 71 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) |
| 72 if match: | 72 if match: |
| 73 opts['message'] = '{0}\n\nRepository: {1}'.format( | 73 opts['base_url'] = 'https://' + match.group(1) |
| 74 opts['message'].strip(), | |
| 75 match.group(1) | |
| 76 ) | |
| 77 | 74 |
| 78 # Make sure there is at least one reviewer | 75 # Make sure there is at least one reviewer |
| 79 if not opts.get('reviewers'): | 76 if not opts.get('reviewers'): |
| 80 opts['reviewers'] = ui.prompt('Reviewers (comma-separated): ', '') | 77 opts['reviewers'] = ui.prompt('Reviewers (comma-separated): ', '') |
| 81 if not opts['reviewers'].strip(): | 78 if not opts['reviewers'].strip(): |
| 82 raise error.Abort('No reviewers given.') | 79 raise error.Abort('No reviewers given.') |
| 83 | 80 |
| 84 for opt in ('reviewers', 'cc'): | 81 for opt in ('reviewers', 'cc'): |
| 85 if opts.get(opt): | 82 if opts.get(opt): |
| 86 users = [u if '@' in u else u + '@adblockplus.org' | 83 users = [u if '@' in u else u + '@adblockplus.org' |
| 87 for u in re.split(r'\s*,\s*', opts[opt])] | 84 for u in re.split(r'\s*,\s*', opts[opt])] |
| 88 opts[opt] = ','.join(users) | 85 opts[opt] = ','.join(users) |
| 89 | 86 |
| 90 for opt in ('issue', 'title', 'message', 'reviewers', 'cc'): | 87 for opt in ('issue', 'title', 'message', 'reviewers', 'cc', 'base_url'): |
| 91 if opts.get(opt, ''): | 88 if opts.get(opt, ''): |
| 92 args.extend(['--' + opt, opts[opt]]) | 89 args.extend(['--' + opt, opts[opt]]) |
| 93 | 90 |
| 94 for opt in ('private', 'assume_yes', 'print_diffs'): | 91 for opt in ('private', 'assume_yes', 'print_diffs'): |
| 95 if opts.get(opt, False): | 92 if opts.get(opt, False): |
| 96 args.append('--' + opt) | 93 args.append('--' + opt) |
| 97 | 94 |
| 98 args.extend(paths) | 95 args.extend(paths) |
| 99 | 96 |
| 100 upload_path = ui.config('review', 'uploadtool_path', | 97 upload_path = ui.config('review', 'uploadtool_path', |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 </body> | 148 </body> |
| 152 </html> | 149 </html> |
| 153 ''' % port | 150 ''' % port |
| 154 | 151 |
| 155 # Run the upload tool | 152 # Run the upload tool |
| 156 issue, patchset = scope['RealMain']([upload_path] + args) | 153 issue, patchset = scope['RealMain']([upload_path] + args) |
| 157 | 154 |
| 158 # Wait for the page to check in and retrieve issue URL | 155 # Wait for the page to check in and retrieve issue URL |
| 159 if server: | 156 if server: |
| 160 server.handle_request() | 157 server.handle_request() |
| OLD | NEW |