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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 elif ui.quiet: | 45 elif ui.quiet: |
46 args.append('--quiet') | 46 args.append('--quiet') |
47 | 47 |
48 if (not opts.get('no_mail') and | 48 if (not opts.get('no_mail') and |
49 (not opts.get('issue') or opts.get('message'))): | 49 (not opts.get('issue') or opts.get('message'))): |
50 args.append('--send_mail') | 50 args.append('--send_mail') |
51 | 51 |
52 if opts.get('revision') and opts.get('change'): | 52 if opts.get('revision') and opts.get('change'): |
53 raise error.Abort('Ambiguous revision range, only one of --revision and --change can be specified.') | 53 raise error.Abort('Ambiguous revision range, only one of --revision and --change can be specified.') |
54 if opts.get('change'): | 54 if opts.get('change'): |
55 rev = repo[opts['change']] | 55 try: |
56 rev_no = int(opts['change']) | |
57 except ValueError: | |
58 raise error.Abort('Argument of --change must be an integer') | |
hub
2018/10/01 16:06:14
I'm not sure I understand correctly. Do you bail i
Vasily Kuznetsov
2018/10/01 16:32:51
Yeah, it seems that repo[x] kind of expects x to b
Vasily Kuznetsov
2018/10/02 10:06:44
I switched to using repo.revs() API. It's not docu
| |
59 rev = repo[rev_no] | |
56 args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)]) | 60 args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)]) |
57 elif opts.get('revision'): | 61 elif opts.get('revision'): |
58 args.extend(['--rev', opts['revision']]) | 62 args.extend(['--rev', opts['revision']]) |
59 else: | 63 else: |
60 raise error.Abort('What should be reviewed? Either --revision or --chang e is required.') | 64 raise error.Abort('What should be reviewed? Either --revision or --chang e is required.') |
61 | 65 |
62 if not opts.get('issue'): | 66 if not opts.get('issue'): |
63 # New issue, make sure title and message are set | 67 # New issue, make sure title and message are set |
64 fulltitle = None | 68 fulltitle = None |
65 | 69 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 </body> | 167 </body> |
164 </html> | 168 </html> |
165 ''' % port | 169 ''' % port |
166 | 170 |
167 # Run the upload tool | 171 # Run the upload tool |
168 issue, patchset = scope['RealMain']([upload_path] + args) | 172 issue, patchset = scope['RealMain']([upload_path] + args) |
169 | 173 |
170 # Wait for the page to check in and retrieve issue URL | 174 # Wait for the page to check in and retrieve issue URL |
171 if server: | 175 if server: |
172 server.handle_request() | 176 server.handle_request() |
OLD | NEW |