Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Side by Side Diff: tools/add_codereview_message.py

Issue 353853003: Whitespace fixes for Python tools (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/misc_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2 1 #!/usr/bin/python2
2 2
3 # Copyright 2014 Google Inc. 3 # Copyright 2014 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 """Add message to codereview issue. 8 """Add message to codereview issue.
9 9
10 This script takes a codereview issue number as its argument and a (possibly 10 This script takes a codereview issue number as its argument and a (possibly
(...skipping 14 matching lines...) Expand all
25 25
26 import fix_pythonpath # pylint: disable=W0611 26 import fix_pythonpath # pylint: disable=W0611
27 from common.py.utils import find_depot_tools # pylint: disable=W0611 27 from common.py.utils import find_depot_tools # pylint: disable=W0611
28 import rietveld 28 import rietveld
29 29
30 30
31 RIETVELD_URL = 'https://codereview.chromium.org' 31 RIETVELD_URL = 'https://codereview.chromium.org'
32 32
33 33
34 def add_codereview_message(issue, message): 34 def add_codereview_message(issue, message):
35 """Add a message to a given codereview. 35 """Add a message to a given codereview.
36 36
37 Args: 37 Args:
38 codereview_url: (string) we will extract the issue number from 38 codereview_url: (string) we will extract the issue number from
39 this url, or this could simply be the issue number. 39 this url, or this could simply be the issue number.
40 message: (string) message to add. 40 message: (string) message to add.
41 """ 41 """
42 # Passing None for the email and password will result in a prompt or 42 # Passing None for the email and password will result in a prompt or
43 # reuse of existing cached credentials. 43 # reuse of existing cached credentials.
44 my_rietveld = rietveld.Rietveld(RIETVELD_URL, email=None, password=None) 44 my_rietveld = rietveld.Rietveld(RIETVELD_URL, email=None, password=None)
45 45
46 my_rietveld.add_comment(issue, message) 46 my_rietveld.add_comment(issue, message)
47 47
48 48
49 def main(argv): 49 def main(argv):
50 """main function; see module-level docstring and GetOptionParser help. 50 """main function; see module-level docstring and GetOptionParser help.
51 51
52 Args: 52 Args:
53 argv: sys.argv[1:]-type argument list. 53 argv: sys.argv[1:]-type argument list.
54 """ 54 """
55 option_parser = optparse.OptionParser(usage=__doc__) 55 option_parser = optparse.OptionParser(usage=__doc__)
56 _, arguments = option_parser.parse_args(argv) 56 _, arguments = option_parser.parse_args(argv)
57 57
58 if len(arguments) > 1: 58 if len(arguments) > 1:
59 option_parser.error('Extra arguments.') 59 option_parser.error('Extra arguments.')
60 if len(arguments) != 1: 60 if len(arguments) != 1:
61 option_parser.error('Missing issue number.') 61 option_parser.error('Missing issue number.')
62 62
63 message = sys.stdin.read() 63 message = sys.stdin.read()
64 add_codereview_message(int(arguments[0]), message) 64 add_codereview_message(int(arguments[0]), message)
65 65
66 66
67 if __name__ == '__main__': 67 if __name__ == '__main__':
68 main(sys.argv[1:]) 68 main(sys.argv[1:])
69 69
OLDNEW
« no previous file with comments | « no previous file | tools/misc_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698