Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 if opts.get('change'): | 51 if opts.get('change'): |
52 rev = repo[opts['change']] | 52 rev = repo[opts['change']] |
53 args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)]) | 53 args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)]) |
54 elif opts.get('revision'): | 54 elif opts.get('revision'): |
55 args.extend(['--rev', opts['revision']]) | 55 args.extend(['--rev', opts['revision']]) |
56 else: | 56 else: |
57 raise error.Abort('What should be reviewed? Either --revision or --chang e is required.') | 57 raise error.Abort('What should be reviewed? Either --revision or --chang e is required.') |
58 | 58 |
59 if not opts.get('issue'): | 59 if not opts.get('issue'): |
60 # New issue, make sure title and message are set | 60 # New issue, make sure title and message are set |
61 if not opts.get('title') and opts.get('change'): | 61 fulltitle = None |
62 opts['title'] = repo[opts['change']].description().rstrip().split('\ n')[0] | 62 |
Vasily Kuznetsov
2017/01/13 17:58:08
There's a bit too much code repetition here and, m
f.nicolaisen
2017/01/15 22:48:09
Acknowledged.
| |
63 opts['message'] = repo[opts['change']].description() | 63 if not opts.get('title') and not opts.get('change'): |
64 if not opts.get('title'): | |
65 opts['title'] = ui.prompt('New review title: ', '') | 64 opts['title'] = ui.prompt('New review title: ', '') |
65 elif not opts.get('title'): | |
66 fulltitle = repo[opts['change']].description() | |
67 opts['title'] = fulltitle.rstrip().split('\n')[0] | |
68 | |
66 if not opts['title'].strip(): | 69 if not opts['title'].strip(): |
67 raise error.Abort('No review title given.') | 70 raise error.Abort('No review title given.') |
68 | 71 |
69 if not opts.get('message'): | 72 if not opts.get('message'): |
70 opts['message'] = opts['title'] | 73 opts['message'] = fulltitle or opts['title'] |
71 | 74 |
72 path = (ui.config('paths', 'default-push') | 75 path = (ui.config('paths', 'default-push') |
73 or ui.config('paths', 'default') | 76 or ui.config('paths', 'default') |
74 or '') | 77 or '') |
75 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) | 78 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) |
76 if match: | 79 if match: |
77 opts['base_url'] = 'https://' + match.group(1) | 80 opts['base_url'] = 'https://' + match.group(1) |
78 | 81 |
79 # Make sure there is at least one reviewer | 82 # Make sure there is at least one reviewer |
80 if not opts.get('reviewers'): | 83 if not opts.get('reviewers'): |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 </body> | 160 </body> |
158 </html> | 161 </html> |
159 ''' % port | 162 ''' % port |
160 | 163 |
161 # Run the upload tool | 164 # Run the upload tool |
162 issue, patchset = scope['RealMain']([upload_path] + args) | 165 issue, patchset = scope['RealMain']([upload_path] + args) |
163 | 166 |
164 # Wait for the page to check in and retrieve issue URL | 167 # Wait for the page to check in and retrieve issue URL |
165 if server: | 168 if server: |
166 server.handle_request() | 169 server.handle_request() |
LEFT | RIGHT |