| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import json | 5 import json |
| 6 import re | 6 import re |
| 7 import time | 7 import time |
| 8 import urllib | 8 import urllib |
| 9 | 9 |
| 10 from . import config_validation | 10 from . import config_validation |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 def _expand_initial_revision_range(self): | 370 def _expand_initial_revision_range(self): |
| 371 """Sets the initial contents of |self.revisions|.""" | 371 """Sets the initial contents of |self.revisions|.""" |
| 372 with self.api.m.step.nest('Expanding revision range'): | 372 with self.api.m.step.nest('Expanding revision range'): |
| 373 good_hash = self.good_rev.commit_hash | 373 good_hash = self.good_rev.commit_hash |
| 374 bad_hash = self.bad_rev.commit_hash | 374 bad_hash = self.bad_rev.commit_hash |
| 375 step_name = 'for revisions %s:%s' % (good_hash, bad_hash) | 375 step_name = 'for revisions %s:%s' % (good_hash, bad_hash) |
| 376 revisions = self._revision_range( | 376 revisions = self._revision_range( |
| 377 start=good_hash, | 377 start=good_hash, |
| 378 end=bad_hash, | 378 end=bad_hash, |
| 379 depot_name=self.base_depot, | 379 depot_name=self.base_depot, |
| 380 step_name=step_name) | 380 step_name=step_name, |
| 381 exclude_end=True) |
| 381 self.revisions = [self.good_rev] + revisions + [self.bad_rev] | 382 self.revisions = [self.good_rev] + revisions + [self.bad_rev] |
| 382 self._update_revision_list_indexes() | 383 self._update_revision_list_indexes() |
| 383 | 384 |
| 384 def _revision_range(self, start, end, depot_name, base_revision=None, | 385 def _revision_range(self, start, end, depot_name, base_revision=None, |
| 385 step_name=None): | 386 step_name=None, exclude_end=False): |
| 386 """Returns a list of RevisionState objects between |start| and |end|. | 387 """Returns a list of RevisionState objects between |start| and |end|. |
| 387 | 388 |
| 389 When expanding the initial revision range we want to exclude the last |
| 390 revision, since both good and bad have already been created and tested. |
| 391 When bisecting into a roll on the other hand, we want to include the last |
| 392 revision in the roll, because although the code should be equivalent to |
| 393 the roll, we want to blame the right culprit and not the roll. |
| 394 |
| 388 Args: | 395 Args: |
| 389 start (str): Start commit hash. | 396 start (str): Start commit hash. |
| 390 end (str): End commit hash. | 397 end (str): End commit hash. |
| 391 depot_name (str): Short string name of repo, e.g. chromium or v8. | 398 depot_name (str): Short string name of repo, e.g. chromium or v8. |
| 392 base_revision (str): Base revision in the downstream repo (e.g. chromium). | 399 base_revision (str): Base revision in the downstream repo (e.g. chromium). |
| 393 step_name (str): Optional step name. | 400 step_name (str): Optional step name. |
| 401 exclude_end (bool): Whether to exclude the last revision in the range, |
| 402 i.e. the revision given as end. |
| 394 | 403 |
| 395 Returns: | 404 Returns: |
| 396 A list of RevisionState objects, not including the given start or end. | 405 A list of RevisionState objects. |
| 397 """ | 406 """ |
| 398 if self.internal_bisect: # pragma: no cover | 407 if self.internal_bisect: # pragma: no cover |
| 399 return self._revision_range_with_gitiles( | 408 return self._revision_range_with_gitiles( |
| 400 start, end, depot_name, base_revision, step_name) | 409 start, end, depot_name, base_revision, step_name) |
| 401 try: | 410 try: |
| 402 step_result = self.api.m.python( | 411 step_result = self.api.m.python( |
| 403 step_name, | 412 step_name, |
| 404 self.api.resource('fetch_intervening_revisions.py'), | 413 self.api.resource('fetch_intervening_revisions.py'), |
| 405 [start, end, depot_config.DEPOT_DEPS_NAME[depot_name]['url']], | 414 [start, end, depot_config.DEPOT_DEPS_NAME[depot_name]['url']], |
| 406 stdout=self.api.m.json.output()) | 415 stdout=self.api.m.json.output()) |
| 407 except self.api.m.step.StepFailure: # pragma: no cover | 416 except self.api.m.step.StepFailure: # pragma: no cover |
| 408 self.surface_result('BAD_REV') | 417 self.surface_result('BAD_REV') |
| 409 raise | 418 raise |
| 410 revisions = [] | 419 revisions = [] |
| 411 for commit_hash, _ in step_result.stdout: | 420 revision_hashes = step_result.stdout |
| 421 if exclude_end: |
| 422 revision_hashes = revision_hashes[:-1] |
| 423 for commit_hash, _ in revision_hashes: |
| 412 revisions.append(self.revision_class( | 424 revisions.append(self.revision_class( |
| 413 bisector=self, | 425 bisector=self, |
| 414 commit_hash=commit_hash, | 426 commit_hash=commit_hash, |
| 415 depot_name=depot_name, | 427 depot_name=depot_name, |
| 416 base_revision=base_revision)) | 428 base_revision=base_revision)) |
| 417 return revisions | 429 return revisions |
| 418 | 430 |
| 419 def _revision_range_with_gitiles(self, start, end, depot_name, | 431 def _revision_range_with_gitiles(self, start, end, depot_name, |
| 420 base_revision=None, step_name=None): # pragma: no cover | 432 base_revision=None, step_name=None): # pragma: no cover |
| 421 """Returns a list of RevisionState objects between |start| and |end|. | 433 """Returns a list of RevisionState objects between |start| and |end|. |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 }) | 958 }) |
| 947 return revision_rows | 959 return revision_rows |
| 948 | 960 |
| 949 def _get_build_url(self): | 961 def _get_build_url(self): |
| 950 properties = self.api.m.properties | 962 properties = self.api.m.properties |
| 951 bot_url = properties.get('buildbotURL', | 963 bot_url = properties.get('buildbotURL', |
| 952 'http://build.chromium.org/p/chromium/') | 964 'http://build.chromium.org/p/chromium/') |
| 953 builder_name = urllib.quote(properties.get('buildername', '')) | 965 builder_name = urllib.quote(properties.get('buildername', '')) |
| 954 builder_number = str(properties.get('buildnumber', '')) | 966 builder_number = str(properties.get('buildnumber', '')) |
| 955 return '%sbuilders/%s/builds/%s' % (bot_url, builder_name, builder_number) | 967 return '%sbuilders/%s/builds/%s' % (bot_url, builder_name, builder_number) |
| OLD | NEW |