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 json | 10 import json |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 patchset_to_apply) | 202 patchset_to_apply) |
203 print('Downloading patch from %s' % issue_url) | 203 print('Downloading patch from %s' % issue_url) |
204 try: | 204 try: |
205 patchset = obj.get_patch(issue_to_apply, patchset_to_apply) | 205 patchset = obj.get_patch(issue_to_apply, patchset_to_apply) |
206 except urllib2.HTTPError as e: | 206 except urllib2.HTTPError as e: |
207 print( | 207 print( |
208 'Failed to fetch the patch for issue %d, patchset %d.\n' | 208 'Failed to fetch the patch for issue %d, patchset %d.\n' |
209 'Try visiting %s/%d') % ( | 209 'Try visiting %s/%d') % ( |
210 issue_to_apply, patchset_to_apply, | 210 issue_to_apply, patchset_to_apply, |
211 options.server, issue_to_apply) | 211 options.server, issue_to_apply) |
212 return 1 | 212 # Special code for bot_update to indicate that cause is network or |
| 213 # Rietveld. Not 2, because 2 is returned on arg parsing failure. |
| 214 return 3 |
213 if options.whitelist: | 215 if options.whitelist: |
214 patchset.patches = [patch for patch in patchset.patches | 216 patchset.patches = [patch for patch in patchset.patches |
215 if patch.filename in options.whitelist] | 217 if patch.filename in options.whitelist] |
216 if options.blacklist: | 218 if options.blacklist: |
217 patchset.patches = [patch for patch in patchset.patches | 219 patchset.patches = [patch for patch in patchset.patches |
218 if patch.filename not in options.blacklist] | 220 if patch.filename not in options.blacklist] |
219 for patch in patchset.patches: | 221 for patch in patchset.patches: |
220 print(patch) | 222 print(patch) |
221 full_dir = os.path.abspath(options.root_dir) | 223 full_dir = os.path.abspath(options.root_dir) |
222 scm_type = scm.determine_scm(full_dir) | 224 scm_type = scm.determine_scm(full_dir) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 return 0 | 281 return 0 |
280 | 282 |
281 | 283 |
282 if __name__ == "__main__": | 284 if __name__ == "__main__": |
283 fix_encoding.fix_encoding() | 285 fix_encoding.fix_encoding() |
284 try: | 286 try: |
285 sys.exit(main()) | 287 sys.exit(main()) |
286 except KeyboardInterrupt: | 288 except KeyboardInterrupt: |
287 sys.stderr.write('interrupted\n') | 289 sys.stderr.write('interrupted\n') |
288 sys.exit(1) | 290 sys.exit(1) |
OLD | NEW |