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 opts.get('change'): | 61 fulltitle = None |
62 description = repo[opts['change']].description() | 62 |
63 else: | 63 if not opts.get('title') and not opts.get('change'): |
64 description = ui.prompt('New review title: ', '') | 64 opts['title'] = ui.prompt('New review title: ', '') |
Wladimir Palant
2017/01/16 10:11:43
The logic change here will have the effect that th
Vasily Kuznetsov
2017/01/16 10:46:07
Yes, that's right. I also missed this case when su
Wladimir Palant
2017/01/16 21:50:50
This isn't the right thing to do either. We should
Vasily Kuznetsov
2017/01/16 22:39:05
My thinking was that it's quite unlikely that some
Wladimir Palant
2017/01/17 10:30:17
It's not impossible however - typically the data c
| |
65 if not opts.get('title'): | 65 elif not opts.get('title'): |
66 # Drop everything but the first line of description in title | 66 fulltitle = repo[opts['change']].description() |
67 opts['title'] = description.rstrip().split('\n')[0] | 67 opts['title'] = fulltitle.rstrip().split('\n')[0] |
68 | |
68 if not opts['title'].strip(): | 69 if not opts['title'].strip(): |
69 raise error.Abort('No review title given.') | 70 raise error.Abort('No review title given.') |
70 | 71 |
71 if not opts.get('message'): | 72 if not opts.get('message'): |
72 opts['message'] = description | 73 opts['message'] = fulltitle or opts['title'] |
73 | 74 |
74 path = (ui.config('paths', 'default-push') | 75 path = (ui.config('paths', 'default-push') |
75 or ui.config('paths', 'default') | 76 or ui.config('paths', 'default') |
76 or '') | 77 or '') |
77 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) | 78 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) |
78 if match: | 79 if match: |
79 opts['base_url'] = 'https://' + match.group(1) | 80 opts['base_url'] = 'https://' + match.group(1) |
80 | 81 |
81 # Make sure there is at least one reviewer | 82 # Make sure there is at least one reviewer |
82 if not opts.get('reviewers'): | 83 if not opts.get('reviewers'): |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 </body> | 160 </body> |
160 </html> | 161 </html> |
161 ''' % port | 162 ''' % port |
162 | 163 |
163 # Run the upload tool | 164 # Run the upload tool |
164 issue, patchset = scope['RealMain']([upload_path] + args) | 165 issue, patchset = scope['RealMain']([upload_path] + args) |
165 | 166 |
166 # Wait for the page to check in and retrieve issue URL | 167 # Wait for the page to check in and retrieve issue URL |
167 if server: | 168 if server: |
168 server.handle_request() | 169 server.handle_request() |
LEFT | RIGHT |