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 import getpass | 8 import getpass |
9 import json | 9 import json |
10 import logging | 10 import logging |
11 import optparse | 11 import optparse |
12 import os | 12 import os |
13 import subprocess | 13 import subprocess |
14 import sys | 14 import sys |
15 import urllib2 | 15 import urllib2 |
16 | 16 |
17 import breakpad # pylint: disable=W0611 | 17 import breakpad # pylint: disable=W0611 |
18 | 18 |
19 import annotated_gclient | 19 import annotated_gclient |
20 import auth | 20 import auth |
21 import checkout | 21 import checkout |
22 import fix_encoding | 22 import fix_encoding |
23 import gclient_utils | 23 import gclient_utils |
24 import rietveld | 24 import rietveld |
25 import scm | 25 import scm |
26 | 26 |
27 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 27 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
28 | 28 |
29 | 29 |
30 RETURN_CODE_OK = 0 # any other failure, likely patch apply one. | 30 RETURN_CODE_OK = 0 |
31 RETURN_CODE_OTHER_FAILURE = 1 # any other failure, likely patch apply one. | 31 RETURN_CODE_OTHER_FAILURE = 1 # any other failure, likely patch apply one. |
32 RETURN_CODE_ARGPARSE_FAILURE = 2 # default in python. | 32 RETURN_CODE_ARGPARSE_FAILURE = 2 # default in python. |
33 RETURN_CODE_INFRA_FAILURE = 3 # considered as infra failure. | 33 RETURN_CODE_INFRA_FAILURE = 3 # considered as infra failure. |
34 | 34 |
35 | 35 |
36 class Unbuffered(object): | 36 class Unbuffered(object): |
37 """Disable buffering on a file object.""" | 37 """Disable buffering on a file object.""" |
38 def __init__(self, stream): | 38 def __init__(self, stream): |
39 self.stream = stream | 39 self.stream = stream |
40 | 40 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 return RETURN_CODE_OK | 317 return RETURN_CODE_OK |
318 | 318 |
319 | 319 |
320 if __name__ == "__main__": | 320 if __name__ == "__main__": |
321 fix_encoding.fix_encoding() | 321 fix_encoding.fix_encoding() |
322 try: | 322 try: |
323 sys.exit(main()) | 323 sys.exit(main()) |
324 except KeyboardInterrupt: | 324 except KeyboardInterrupt: |
325 sys.stderr.write('interrupted\n') | 325 sys.stderr.write('interrupted\n') |
326 sys.exit(RETURN_CODE_OTHER_FAILURE) | 326 sys.exit(RETURN_CODE_OTHER_FAILURE) |
OLD | NEW |