OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Applies an issue from Rietveld. | 6 """Applies an issue from Rietveld. |
7 """ | 7 """ |
8 | 8 |
9 import getpass | 9 import getpass |
10 import logging | 10 import logging |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 min(2, options.verbose)]) | 58 min(2, options.verbose)]) |
59 if args: | 59 if args: |
60 parser.error('Extra argument(s) "%s" not understood' % ' '.join(args)) | 60 parser.error('Extra argument(s) "%s" not understood' % ' '.join(args)) |
61 if not options.issue: | 61 if not options.issue: |
62 parser.error('Require --issue') | 62 parser.error('Require --issue') |
63 options.server = options.server.rstrip('/') | 63 options.server = options.server.rstrip('/') |
64 if not options.server: | 64 if not options.server: |
65 parser.error('Require a valid server') | 65 parser.error('Require a valid server') |
66 | 66 |
67 if options.password == '-': | 67 if options.password == '-': |
| 68 print('Reading password') |
68 options.password = sys.stdin.readline().strip() | 69 options.password = sys.stdin.readline().strip() |
69 | 70 |
70 print('Connecting to %s' % options.server) | 71 print('Connecting to %s' % options.server) |
71 # Always try un-authenticated first. | 72 # Always try un-authenticated first. |
72 # TODO(maruel): Use OAuth2 properly so we don't hit rate-limiting on login | 73 # TODO(maruel): Use OAuth2 properly so we don't hit rate-limiting on login |
73 # attempts. | 74 # attempts. |
74 # Bad except clauses order (HTTPError is an ancestor class of | 75 # Bad except clauses order (HTTPError is an ancestor class of |
75 # ClientLoginError) | 76 # ClientLoginError) |
76 # pylint: disable=E0701 | 77 # pylint: disable=E0701 |
77 obj = rietveld.Rietveld(options.server, '', None) | 78 obj = rietveld.Rietveld(options.server, '', None) |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 if sys.platform == 'win32': | 161 if sys.platform == 'win32': |
161 gclient_path += '.bat' | 162 gclient_path += '.bat' |
162 return subprocess.call( | 163 return subprocess.call( |
163 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root) | 164 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root) |
164 return 0 | 165 return 0 |
165 | 166 |
166 | 167 |
167 if __name__ == "__main__": | 168 if __name__ == "__main__": |
168 fix_encoding.fix_encoding() | 169 fix_encoding.fix_encoding() |
169 sys.exit(main()) | 170 sys.exit(main()) |
OLD | NEW |