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 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 try: | 55 rev_no = repo.revs(opts['change']).first() |
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 rev = repo[rev_no] |
60 args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)]) | 57 args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)]) |
61 elif opts.get('revision'): | 58 elif opts.get('revision'): |
62 args.extend(['--rev', opts['revision']]) | 59 args.extend(['--rev', opts['revision']]) |
63 else: | 60 else: |
64 raise error.Abort('What should be reviewed? Either --revision or --chang e is required.') | 61 raise error.Abort('What should be reviewed? Either --revision or --chang e is required.') |
65 | 62 |
66 if not opts.get('issue'): | 63 if not opts.get('issue'): |
67 # New issue, make sure title and message are set | 64 # New issue, make sure title and message are set |
68 fulltitle = None | 65 fulltitle = None |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 </body> | 164 </body> |
168 </html> | 165 </html> |
169 ''' % port | 166 ''' % port |
170 | 167 |
171 # Run the upload tool | 168 # Run the upload tool |
172 issue, patchset = scope['RealMain']([upload_path] + args) | 169 issue, patchset = scope['RealMain']([upload_path] + args) |
173 | 170 |
174 # Wait for the page to check in and retrieve issue URL | 171 # Wait for the page to check in and retrieve issue URL |
175 if server: | 172 if server: |
176 server.handle_request() | 173 server.handle_request() |
LEFT | RIGHT |