Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: hgreview.py

Issue 29338061: Noissue - Create a wrapper around upload.py with a more convenient command line interface (Closed)
Left Patch Set: Created March 10, 2016, 12:07 p.m.
Right Patch Set: Addressed nit Created March 10, 2016, 12:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « hgrc ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import os 1 import os
2 import re 2 import re
3 import subprocess 3 import subprocess
4 import sys 4 import sys
5 import urllib 5 import urllib
6 6
7 from mercurial import cmdutil, error 7 from mercurial import cmdutil, error
8 8
9 cmdtable = {} 9 cmdtable = {}
10 command = cmdutil.command(cmdtable) 10 command = cmdutil.command(cmdtable)
11 11
12 @command('review', 12 @command('review',
Sebastian Noack 2016/03/10 12:31:05 Note that cmdutil isn't a standard library. IMO th
Wladimir Palant 2016/03/10 12:36:36 No, it isn't a standard library but it is document
Sebastian Noack 2016/03/10 12:44:28 I just realized that this is a Mercurial extension
13 [ 13 [
14 ('i', 'issue', '', 'If given, adds a patch set to this review, otherwise cre ate a new one.', 'ISSUE'), 14 ('i', 'issue', '', 'If given, adds a patch set to this review, otherwise cre ate a new one.', 'ISSUE'),
15 ('r', 'revision', '', 'Revision to diff against or a revision range to uploa d.', 'REV'), 15 ('r', 'revision', '', 'Revision to diff against or a revision range to uploa d.', 'REV'),
16 ('c', 'change', '', 'A single revision to upload.', 'REV'), 16 ('c', 'change', '', 'A single revision to upload.', 'REV'),
17 ('t', 'title', '', 'New review subject or new patch set title.', 'TITLE'), 17 ('t', 'title', '', 'New review subject or new patch set title.', 'TITLE'),
18 ('m', 'message', '', 'New review description or new patch set message.', 'ME SSAGE'), 18 ('m', 'message', '', 'New review description or new patch set message.', 'ME SSAGE'),
19 ('w', 'reviewers', '', 'Add reviewers (comma separated email addresses or @a dblockplus.org user names).', 'REVIEWERS'), 19 ('w', 'reviewers', '', 'Add reviewers (comma separated email addresses or @a dblockplus.org user names).', 'REVIEWERS'),
20 ('', 'cc', '', 'Add CC (comma separated email addresses or @adblockplus.org user names).', 'CC'), 20 ('', 'cc', '', 'Add CC (comma separated email addresses or @adblockplus.org user names).', 'CC'),
21 ('', 'private', None, 'Make the review restricted to reviewers and those CCe d.'), 21 ('', 'private', None, 'Make the review restricted to reviewers and those CCe d.'),
22 ('y', 'assume_yes', None, 'Assume that the answer to yes/no questions is \'y es\'.'), 22 ('y', 'assume_yes', None, 'Assume that the answer to yes/no questions is \'y es\'.'),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 opts[opt] = ','.join(users) 60 opts[opt] = ','.join(users)
61 61
62 for opt in ('issue', 'title', 'message', 'reviewers', 'cc'): 62 for opt in ('issue', 'title', 'message', 'reviewers', 'cc'):
63 if opts.get(opt, ''): 63 if opts.get(opt, ''):
64 args.extend(['--' + opt, opts[opt]]) 64 args.extend(['--' + opt, opts[opt]])
65 65
66 for opt in ('private', 'assume_yes', 'print_diffs'): 66 for opt in ('private', 'assume_yes', 'print_diffs'):
67 if opts.get(opt, False): 67 if opts.get(opt, False):
68 args.append('--' + opt) 68 args.append('--' + opt)
69 69
70 args += paths 70 args.extend(paths)
Sebastian Noack 2016/03/10 12:31:05 Nit: Why not modifying args inline as above using
Wladimir Palant 2016/03/10 12:36:36 Done.
71 71
72 upload_path = ui.config('review', 'uploadtool_path', 72 upload_path = ui.config('review', 'uploadtool_path',
73 os.path.join('~', '.hgreview_upload.py')) 73 os.path.join('~', '.hgreview_upload.py'))
74 upload_path = os.path.expanduser(upload_path) 74 upload_path = os.path.expanduser(upload_path)
75 if not os.path.exists(upload_path): 75 if not os.path.exists(upload_path):
76 url = 'https://codereview.adblockplus.org/static/upload.py' 76 url = 'https://codereview.adblockplus.org/static/upload.py'
77 ui.status('Downloading {0} to {1}.\n'.format(url, upload_path)) 77 ui.status('Downloading {0} to {1}.\n'.format(url, upload_path))
78 urllib.urlretrieve(url, upload_path) 78 urllib.urlretrieve(url, upload_path)
79 79
80 subprocess.call([sys.executable, upload_path] + args) 80 subprocess.call([sys.executable, upload_path] + args)
LEFTRIGHT
« hgrc ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld