OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Utility functions used by the bisect tool. | 5 """Utility functions used by the bisect tool. |
6 | 6 |
7 This includes functions related to checking out the depot and outputting | 7 This includes functions related to checking out the depot and outputting |
8 annotations for the Buildbot waterfall. | 8 annotations for the Buildbot waterfall. |
9 """ | 9 """ |
10 | 10 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 """Cleans up any leftover index.lock files after running git.""" | 345 """Cleans up any leftover index.lock files after running git.""" |
346 # If a previous run of git crashed, or bot was reset, etc., then we might | 346 # If a previous run of git crashed, or bot was reset, etc., then we might |
347 # end up with leftover index.lock files. | 347 # end up with leftover index.lock files. |
348 for path, _, files in os.walk(cwd): | 348 for path, _, files in os.walk(cwd): |
349 for cur_file in files: | 349 for cur_file in files: |
350 if cur_file.endswith('index.lock'): | 350 if cur_file.endswith('index.lock'): |
351 path_to_file = os.path.join(path, cur_file) | 351 path_to_file = os.path.join(path, cur_file) |
352 os.remove(path_to_file) | 352 os.remove(path_to_file) |
353 | 353 |
354 | 354 |
355 def RunGClientAndSync(revision=None, cwd=None): | 355 def RunGClientAndSync(revisions=None, cwd=None): |
356 """Runs gclient and does a normal sync. | 356 """Runs gclient and does a normal sync. |
357 | 357 |
358 Args: | 358 Args: |
359 revision: Revision that need to be synced. | 359 revisions: List of revisions that need to be synced. |
| 360 E.g., "src@2ae43f...", "src/third_party/webkit@asr1234" etc. |
360 cwd: Working directory to run from. | 361 cwd: Working directory to run from. |
361 | 362 |
362 Returns: | 363 Returns: |
363 The return code of the call. | 364 The return code of the call. |
364 """ | 365 """ |
365 params = ['sync', '--verbose', '--nohooks', '--force', | 366 params = ['sync', '--verbose', '--nohooks', '--force', |
366 '--delete_unversioned_trees'] | 367 '--delete_unversioned_trees'] |
367 if revision: | 368 if revisions is not None: |
368 params.extend(['--revision', revision]) | 369 for revision in revisions: |
| 370 params.extend(['--revision', revision]) |
369 return RunGClient(params, cwd=cwd) | 371 return RunGClient(params, cwd=cwd) |
370 | 372 |
371 | 373 |
372 def SetupGitDepot(opts, custom_deps): | 374 def SetupGitDepot(opts, custom_deps): |
373 """Sets up the depot for the bisection. | 375 """Sets up the depot for the bisection. |
374 | 376 |
375 The depot will be located in a subdirectory called 'bisect'. | 377 The depot will be located in a subdirectory called 'bisect'. |
376 | 378 |
377 Args: | 379 Args: |
378 opts: The options parsed from the command line through parse_args(). | 380 opts: The options parsed from the command line through parse_args(). |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 platform = os.environ.get('PROCESSOR_ARCHITECTURE') | 547 platform = os.environ.get('PROCESSOR_ARCHITECTURE') |
546 return platform and platform in ['AMD64', 'I64'] | 548 return platform and platform in ['AMD64', 'I64'] |
547 | 549 |
548 | 550 |
549 def IsLinuxHost(): | 551 def IsLinuxHost(): |
550 return sys.platform.startswith('linux') | 552 return sys.platform.startswith('linux') |
551 | 553 |
552 | 554 |
553 def IsMacHost(): | 555 def IsMacHost(): |
554 return sys.platform.startswith('darwin') | 556 return sys.platform.startswith('darwin') |
OLD | NEW |