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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 """Cleans up any leftover index.lock files after running git.""" | 326 """Cleans up any leftover index.lock files after running git.""" |
327 # If a previous run of git crashed, or bot was reset, etc., then we might | 327 # If a previous run of git crashed, or bot was reset, etc., then we might |
328 # end up with leftover index.lock files. | 328 # end up with leftover index.lock files. |
329 for path, _, files in os.walk(cwd): | 329 for path, _, files in os.walk(cwd): |
330 for cur_file in files: | 330 for cur_file in files: |
331 if cur_file.endswith('index.lock'): | 331 if cur_file.endswith('index.lock'): |
332 path_to_file = os.path.join(path, cur_file) | 332 path_to_file = os.path.join(path, cur_file) |
333 os.remove(path_to_file) | 333 os.remove(path_to_file) |
334 | 334 |
335 | 335 |
336 def RunGClientAndSync(cwd=None): | 336 def RunGClientAndSync(revision=None, cwd=None): |
337 """Runs gclient and does a normal sync. | 337 """Runs gclient and does a normal sync. |
338 | 338 |
339 Args: | 339 Args: |
| 340 revision: Revision that need to be synced. |
340 cwd: Working directory to run from. | 341 cwd: Working directory to run from. |
341 | 342 |
342 Returns: | 343 Returns: |
343 The return code of the call. | 344 The return code of the call. |
344 """ | 345 """ |
345 params = ['sync', '--verbose', '--nohooks', '--reset', '--force', | 346 params = ['sync', '--verbose', '--nohooks', '--force', |
346 '--delete_unversioned_trees'] | 347 '--delete_unversioned_trees'] |
| 348 if revision: |
| 349 params.extend(['--revision', revision]) |
347 return RunGClient(params, cwd=cwd) | 350 return RunGClient(params, cwd=cwd) |
348 | 351 |
349 | 352 |
350 def SetupGitDepot(opts, custom_deps): | 353 def SetupGitDepot(opts, custom_deps): |
351 """Sets up the depot for the bisection. | 354 """Sets up the depot for the bisection. |
352 | 355 |
353 The depot will be located in a subdirectory called 'bisect'. | 356 The depot will be located in a subdirectory called 'bisect'. |
354 | 357 |
355 Args: | 358 Args: |
356 opts: The options parsed from the command line through parse_args(). | 359 opts: The options parsed from the command line through parse_args(). |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 platform = os.environ.get('PROCESSOR_ARCHITECTURE') | 526 platform = os.environ.get('PROCESSOR_ARCHITECTURE') |
524 return platform and platform in ['AMD64', 'I64'] | 527 return platform and platform in ['AMD64', 'I64'] |
525 | 528 |
526 | 529 |
527 def IsLinuxHost(): | 530 def IsLinuxHost(): |
528 return sys.platform.startswith('linux') | 531 return sys.platform.startswith('linux') |
529 | 532 |
530 | 533 |
531 def IsMacHost(): | 534 def IsMacHost(): |
532 return sys.platform.startswith('darwin') | 535 return sys.platform.startswith('darwin') |
OLD | NEW |