| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 parser.add_option('--no-auth', action='store_true', | 80 parser.add_option('--no-auth', action='store_true', |
| 81 help='Do not attempt authenticated requests.') | 81 help='Do not attempt authenticated requests.') |
| 82 parser.add_option('--revision-mapping', default='{}', | 82 parser.add_option('--revision-mapping', default='{}', |
| 83 help='When running gclient, annotate the got_revisions ' | 83 help='When running gclient, annotate the got_revisions ' |
| 84 'using the revision-mapping.') | 84 'using the revision-mapping.') |
| 85 parser.add_option('-f', '--force', action='store_true', | 85 parser.add_option('-f', '--force', action='store_true', |
| 86 help='Really run apply_issue, even if .update.flag ' | 86 help='Really run apply_issue, even if .update.flag ' |
| 87 'is detected.') | 87 'is detected.') |
| 88 parser.add_option('-b', '--base_ref', help='Base git ref to patch on top of, ' | 88 parser.add_option('-b', '--base_ref', help='Base git ref to patch on top of, ' |
| 89 'used for verification.') | 89 'used for verification.') |
| 90 parser.add_option('-d', '--ignore_deps', action='store_true', |
| 91 help='Don\'t run gclient sync on DEPS changes.') |
| 90 options, args = parser.parse_args() | 92 options, args = parser.parse_args() |
| 91 | 93 |
| 92 if options.password and options.private_key_file: | 94 if options.password and options.private_key_file: |
| 93 parser.error('-k and -w options are incompatible') | 95 parser.error('-k and -w options are incompatible') |
| 94 if options.email and options.email_file: | 96 if options.email and options.email_file: |
| 95 parser.error('-e and -E options are incompatible') | 97 parser.error('-e and -E options are incompatible') |
| 96 | 98 |
| 97 if (os.path.isfile(os.path.join(os.getcwd(), 'update.flag')) | 99 if (os.path.isfile(os.path.join(os.getcwd(), 'update.flag')) |
| 98 and not options.force): | 100 and not options.force): |
| 99 print 'update.flag file found: bot_update has run and checkout is already ' | 101 print 'update.flag file found: bot_update has run and checkout is already ' |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 scm_obj.apply_patch( | 213 scm_obj.apply_patch( |
| 212 patchset, verbose=True, | 214 patchset, verbose=True, |
| 213 email=properties.get('owner_email', 'chrome-bot@chromium.org'), | 215 email=properties.get('owner_email', 'chrome-bot@chromium.org'), |
| 214 name=properties.get('owner', 'chrome-bot')) | 216 name=properties.get('owner', 'chrome-bot')) |
| 215 except checkout.PatchApplicationFailed, e: | 217 except checkout.PatchApplicationFailed, e: |
| 216 print(str(e)) | 218 print(str(e)) |
| 217 print('CWD=%s' % os.getcwd()) | 219 print('CWD=%s' % os.getcwd()) |
| 218 print('Checkout path=%s' % scm_obj.project_path) | 220 print('Checkout path=%s' % scm_obj.project_path) |
| 219 return 1 | 221 return 1 |
| 220 | 222 |
| 221 if 'DEPS' in map(os.path.basename, patchset.filenames): | 223 if ('DEPS' in map(os.path.basename, patchset.filenames) |
| 224 and not options.ignore_deps): |
| 222 gclient_root = gclient_utils.FindGclientRoot(full_dir) | 225 gclient_root = gclient_utils.FindGclientRoot(full_dir) |
| 223 if gclient_root and scm_type: | 226 if gclient_root and scm_type: |
| 224 print( | 227 print( |
| 225 'A DEPS file was updated inside a gclient checkout, running gclient ' | 228 'A DEPS file was updated inside a gclient checkout, running gclient ' |
| 226 'sync.') | 229 'sync.') |
| 227 base_rev = 'BASE' if scm_type == 'svn' else 'HEAD' | 230 base_rev = 'BASE' if scm_type == 'svn' else 'HEAD' |
| 228 gclient_path = os.path.join(BASE_DIR, 'gclient') | 231 gclient_path = os.path.join(BASE_DIR, 'gclient') |
| 229 if sys.platform == 'win32': | 232 if sys.platform == 'win32': |
| 230 gclient_path += '.bat' | 233 gclient_path += '.bat' |
| 231 with annotated_gclient.temp_filename(suffix='gclient') as f: | 234 with annotated_gclient.temp_filename(suffix='gclient') as f: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 245 f, options.revision_mapping) | 248 f, options.revision_mapping) |
| 246 annotated_gclient.emit_buildprops(revisions) | 249 annotated_gclient.emit_buildprops(revisions) |
| 247 | 250 |
| 248 return retcode | 251 return retcode |
| 249 return 0 | 252 return 0 |
| 250 | 253 |
| 251 | 254 |
| 252 if __name__ == "__main__": | 255 if __name__ == "__main__": |
| 253 fix_encoding.fix_encoding() | 256 fix_encoding.fix_encoding() |
| 254 sys.exit(main()) | 257 sys.exit(main()) |
| OLD | NEW |