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' |
11 UPLOADTOOL_URL = SERVER + '/static/upload.py' | 11 UPLOADTOOL_URL = SERVER + '/static/upload.py' |
12 | 12 |
13 cmdtable = {} | 13 cmdtable = {} |
14 try: | 14 try: |
15 command = cmdutil.command(cmdtable) | 15 command = cmdutil.command(cmdtable) |
16 except: | 16 except AttributeError: |
Sebastian Noack
2018/08/02 17:13:21
Nit: Bare except is discouraged by PEP-8 (and woul
hub
2018/08/02 18:16:56
fixed.
Sebastian Noack
2018/08/02 19:11:30
I suppose catching AttributeError specifically wou
hub
2018/08/02 19:41:16
I was being broad, but yes that work.
| |
17 from mercurial import registrar | 17 from mercurial import registrar |
18 command = registrar.command(cmdtable) | 18 command = registrar.command(cmdtable) |
19 | 19 |
20 @command('review', | 20 @command('review', |
21 [ | 21 [ |
22 ('i', 'issue', '', 'If given, adds a patch set to this review, othe rwise create a new one.', 'ISSUE'), | 22 ('i', 'issue', '', 'If given, adds a patch set to this review, othe rwise create a new one.', 'ISSUE'), |
23 ('r', 'revision', '', 'Revision to diff against or a revision range to upload.', 'REV'), | 23 ('r', 'revision', '', 'Revision to diff against or a revision range to upload.', 'REV'), |
24 ('c', 'change', '', 'A single revision to upload.', 'REV'), | 24 ('c', 'change', '', 'A single revision to upload.', 'REV'), |
25 ('t', 'title', '', 'New review subject or new patch set title.', 'T ITLE'), | 25 ('t', 'title', '', 'New review subject or new patch set title.', 'T ITLE'), |
26 ('m', 'message', '', 'New review description or new patch set messa ge.', 'MESSAGE'), | 26 ('m', 'message', '', 'New review description or new patch set messa ge.', 'MESSAGE'), |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 </body> | 163 </body> |
164 </html> | 164 </html> |
165 ''' % port | 165 ''' % port |
166 | 166 |
167 # Run the upload tool | 167 # Run the upload tool |
168 issue, patchset = scope['RealMain']([upload_path] + args) | 168 issue, patchset = scope['RealMain']([upload_path] + args) |
169 | 169 |
170 # Wait for the page to check in and retrieve issue URL | 170 # Wait for the page to check in and retrieve issue URL |
171 if server: | 171 if server: |
172 server.handle_request() | 172 server.handle_request() |
LEFT | RIGHT |