| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 if not opts.get('title') and opts.get('change'): |
| 62 opts['title'] = repo[opts['change']].description() | 62 opts['title'] = repo[opts['change']].description().rstrip().split('\ n')[0] |
|
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'): | 64 if not opts.get('title'): |
| 64 opts['title'] = ui.prompt('New review title: ', '') | 65 opts['title'] = ui.prompt('New review title: ', '') |
| 65 if not opts['title'].strip(): | 66 if not opts['title'].strip(): |
| 66 raise error.Abort('No review title given.') | 67 raise error.Abort('No review title given.') |
| 67 | 68 |
| 68 if not opts.get('message'): | 69 if not opts.get('message'): |
| 69 opts['message'] = opts['title'] | 70 opts['message'] = opts['title'] |
| 70 | 71 |
| 71 path = (ui.config('paths', 'default-push') | 72 path = (ui.config('paths', 'default-push') |
| 72 or ui.config('paths', 'default') | 73 or ui.config('paths', 'default') |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 </body> | 157 </body> |
| 157 </html> | 158 </html> |
| 158 ''' % port | 159 ''' % port |
| 159 | 160 |
| 160 # Run the upload tool | 161 # Run the upload tool |
| 161 issue, patchset = scope['RealMain']([upload_path] + args) | 162 issue, patchset = scope['RealMain']([upload_path] + args) |
| 162 | 163 |
| 163 # Wait for the page to check in and retrieve issue URL | 164 # Wait for the page to check in and retrieve issue URL |
| 164 if server: | 165 if server: |
| 165 server.handle_request() | 166 server.handle_request() |
| OLD | NEW |