| 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 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 fulltitle = None | |
| 62 | |
| 63 if opts.get('change'): | |
| 64 fulltitle = repo[opts['change']].description() | |
| 65 else: | |
| 66 fulltitle = ui.prompt('New review title: ', '') | |
|
Wladimir Palant
2017/07/17 14:57:52
So we will be prompting even if --title is given o
f.nicolaisen
2017/07/18 11:52:00
Acknowledged.
| |
| 61 if not opts.get('title') and opts.get('change'): | 67 if not opts.get('title') and opts.get('change'): |
| 62 opts['title'] = repo[opts['change']].description() | 68 fulltitle = repo[opts['change']].description() |
|
Wladimir Palant
2017/07/17 14:57:52
Overwriting fulltitle variable with the same value
f.nicolaisen
2017/07/18 11:52:00
Acknowledged.
| |
| 63 if not opts.get('title'): | 69 opts['title'] = fulltitle.rstrip().split('\n')[0] |
| 64 opts['title'] = ui.prompt('New review title: ', '') | |
| 65 if not opts['title'].strip(): | 70 if not opts['title'].strip(): |
| 66 raise error.Abort('No review title given.') | 71 raise error.Abort('No review title given.') |
| 67 | 72 |
| 68 if not opts.get('message'): | 73 if not opts.get('message'): |
| 69 opts['message'] = opts['title'] | 74 opts['message'] = fulltitle or opts['title'] |
| 70 | 75 |
| 71 path = (ui.config('paths', 'default-push') | 76 path = (ui.config('paths', 'default-push') |
| 72 or ui.config('paths', 'default') | 77 or ui.config('paths', 'default') |
| 73 or '') | 78 or '') |
| 74 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) | 79 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) |
| 75 if match: | 80 if match: |
| 76 opts['base_url'] = 'https://' + match.group(1) | 81 opts['base_url'] = 'https://' + match.group(1) |
| 77 | 82 |
| 78 # Make sure there is at least one reviewer | 83 # Make sure there is at least one reviewer |
| 79 if not opts.get('reviewers'): | 84 if not opts.get('reviewers'): |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 </body> | 161 </body> |
| 157 </html> | 162 </html> |
| 158 ''' % port | 163 ''' % port |
| 159 | 164 |
| 160 # Run the upload tool | 165 # Run the upload tool |
| 161 issue, patchset = scope['RealMain']([upload_path] + args) | 166 issue, patchset = scope['RealMain']([upload_path] + args) |
| 162 | 167 |
| 163 # Wait for the page to check in and retrieve issue URL | 168 # Wait for the page to check in and retrieve issue URL |
| 164 if server: | 169 if server: |
| 165 server.handle_request() | 170 server.handle_request() |
| OLD | NEW |