| 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 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 if patch.filename in options.whitelist] | 256 if patch.filename in options.whitelist] |
| 257 if options.blacklist: | 257 if options.blacklist: |
| 258 patchset.patches = [patch for patch in patchset.patches | 258 patchset.patches = [patch for patch in patchset.patches |
| 259 if patch.filename not in options.blacklist] | 259 if patch.filename not in options.blacklist] |
| 260 for patch in patchset.patches: | 260 for patch in patchset.patches: |
| 261 print(patch) | 261 print(patch) |
| 262 if options.extra_patchlevel: | 262 if options.extra_patchlevel: |
| 263 patch.patchlevel += options.extra_patchlevel | 263 patch.patchlevel += options.extra_patchlevel |
| 264 full_dir = os.path.abspath(options.root_dir) | 264 full_dir = os.path.abspath(options.root_dir) |
| 265 scm_type = scm.determine_scm(full_dir) | 265 scm_type = scm.determine_scm(full_dir) |
| 266 if scm_type == 'svn': | 266 if scm_type == 'git': |
| 267 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None) | |
| 268 elif scm_type == 'git': | |
| 269 scm_obj = checkout.GitCheckout(full_dir, None, None, None, None) | 267 scm_obj = checkout.GitCheckout(full_dir, None, None, None, None) |
| 270 elif scm_type == None: | 268 elif scm_type == None: |
| 271 scm_obj = checkout.RawCheckout(full_dir, None, None) | 269 scm_obj = checkout.RawCheckout(full_dir, None, None) |
| 272 else: | 270 else: |
| 273 parser.error('Couldn\'t determine the scm') | 271 parser.error('Couldn\'t determine the scm') |
| 274 | 272 |
| 275 # TODO(maruel): HACK, remove me. | 273 # TODO(maruel): HACK, remove me. |
| 276 # When run a build slave, make sure buildbot knows that the checkout was | 274 # When run a build slave, make sure buildbot knows that the checkout was |
| 277 # modified. | 275 # modified. |
| 278 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': | 276 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': |
| (...skipping 20 matching lines...) Expand all Loading... |
| 299 'sync.') | 297 'sync.') |
| 300 gclient_path = os.path.join(BASE_DIR, 'gclient') | 298 gclient_path = os.path.join(BASE_DIR, 'gclient') |
| 301 if sys.platform == 'win32': | 299 if sys.platform == 'win32': |
| 302 gclient_path += '.bat' | 300 gclient_path += '.bat' |
| 303 with annotated_gclient.temp_filename(suffix='gclient') as f: | 301 with annotated_gclient.temp_filename(suffix='gclient') as f: |
| 304 cmd = [ | 302 cmd = [ |
| 305 gclient_path, 'sync', | 303 gclient_path, 'sync', |
| 306 '--nohooks', | 304 '--nohooks', |
| 307 '--delete_unversioned_trees', | 305 '--delete_unversioned_trees', |
| 308 ] | 306 ] |
| 309 if scm_type == 'svn': | |
| 310 cmd.extend(['--revision', 'BASE']) | |
| 311 if options.revision_mapping: | 307 if options.revision_mapping: |
| 312 cmd.extend(['--output-json', f]) | 308 cmd.extend(['--output-json', f]) |
| 313 | 309 |
| 314 retcode = subprocess.call(cmd, cwd=gclient_root) | 310 retcode = subprocess.call(cmd, cwd=gclient_root) |
| 315 | 311 |
| 316 if retcode == 0 and options.revision_mapping: | 312 if retcode == 0 and options.revision_mapping: |
| 317 revisions = annotated_gclient.parse_got_revision( | 313 revisions = annotated_gclient.parse_got_revision( |
| 318 f, options.revision_mapping) | 314 f, options.revision_mapping) |
| 319 annotated_gclient.emit_buildprops(revisions) | 315 annotated_gclient.emit_buildprops(revisions) |
| 320 | 316 |
| 321 return retcode | 317 return retcode |
| 322 return RETURN_CODE_OK | 318 return RETURN_CODE_OK |
| 323 | 319 |
| 324 | 320 |
| 325 if __name__ == "__main__": | 321 if __name__ == "__main__": |
| 326 fix_encoding.fix_encoding() | 322 fix_encoding.fix_encoding() |
| 327 try: | 323 try: |
| 328 sys.exit(main()) | 324 sys.exit(main()) |
| 329 except KeyboardInterrupt: | 325 except KeyboardInterrupt: |
| 330 sys.stderr.write('interrupted\n') | 326 sys.stderr.write('interrupted\n') |
| 331 sys.exit(RETURN_CODE_OTHER_FAILURE) | 327 sys.exit(RETURN_CODE_OTHER_FAILURE) |
| OLD | NEW |