| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 options.password = sys.stdin.readline().strip() | 68 options.password = sys.stdin.readline().strip() |
| 69 | 69 |
| 70 print('Connecting to %s' % options.server) |
| 70 # Always try un-authenticated first. | 71 # Always try un-authenticated first. |
| 71 # TODO(maruel): Use OAuth2 properly so we don't hit rate-limiting on login | 72 # TODO(maruel): Use OAuth2 properly so we don't hit rate-limiting on login |
| 72 # attempts. | 73 # attempts. |
| 73 # Bad except clauses order (HTTPError is an ancestor class of | 74 # Bad except clauses order (HTTPError is an ancestor class of |
| 74 # ClientLoginError) | 75 # ClientLoginError) |
| 75 # pylint: disable=E0701 | 76 # pylint: disable=E0701 |
| 76 obj = rietveld.Rietveld(options.server, '', None) | 77 obj = rietveld.Rietveld(options.server, '', None) |
| 77 properties = None | 78 properties = None |
| 78 try: | 79 try: |
| 79 properties = obj.get_issue_properties(options.issue, False) | 80 properties = obj.get_issue_properties(options.issue, False) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 if sys.platform == 'win32': | 160 if sys.platform == 'win32': |
| 160 gclient_path += '.bat' | 161 gclient_path += '.bat' |
| 161 return subprocess.call( | 162 return subprocess.call( |
| 162 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root) | 163 [gclient_path, 'sync', '--revision', base_rev], cwd=gclient_root) |
| 163 return 0 | 164 return 0 |
| 164 | 165 |
| 165 | 166 |
| 166 if __name__ == "__main__": | 167 if __name__ == "__main__": |
| 167 fix_encoding.fix_encoding() | 168 fix_encoding.fix_encoding() |
| 168 sys.exit(main()) | 169 sys.exit(main()) |
| OLD | NEW |