Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/bisector.py

Issue 2282563004: Do not exclude the last revision in the range returned by gitiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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):
dtu 2016/08/26 01:16:56 The skeleton has a similar parameter, but phrased
RobertoCN 2016/08/26 18:17:36 Acknowledged.
386 """Returns a list of RevisionState objects between |start| and |end|. 387 """Returns a list of RevisionState objects between |start| and |end|.
387 388
388 Args: 389 Args:
389 start (str): Start commit hash. 390 start (str): Start commit hash.
390 end (str): End commit hash. 391 end (str): End commit hash.
391 depot_name (str): Short string name of repo, e.g. chromium or v8. 392 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). 393 base_revision (str): Base revision in the downstream repo (e.g. chromium).
393 step_name (str): Optional step name. 394 step_name (str): Optional step name.
394 395
395 Returns: 396 Returns:
396 A list of RevisionState objects, not including the given start or end. 397 A list of RevisionState objects, not including the given start or end.
sullivan 2016/08/25 23:26:55 Need to add documentation for exclude_end argument
RobertoCN 2016/08/26 18:17:36 Done.
397 """ 398 """
398 if self.internal_bisect: # pragma: no cover 399 if self.internal_bisect: # pragma: no cover
399 return self._revision_range_with_gitiles( 400 return self._revision_range_with_gitiles(
400 start, end, depot_name, base_revision, step_name) 401 start, end, depot_name, base_revision, step_name)
401 try: 402 try:
402 step_result = self.api.m.python( 403 step_result = self.api.m.python(
403 step_name, 404 step_name,
404 self.api.resource('fetch_intervening_revisions.py'), 405 self.api.resource('fetch_intervening_revisions.py'),
405 [start, end, depot_config.DEPOT_DEPS_NAME[depot_name]['url']], 406 [start, end, depot_config.DEPOT_DEPS_NAME[depot_name]['url']],
406 stdout=self.api.m.json.output()) 407 stdout=self.api.m.json.output())
407 except self.api.m.step.StepFailure: # pragma: no cover 408 except self.api.m.step.StepFailure: # pragma: no cover
408 self.surface_result('BAD_REV') 409 self.surface_result('BAD_REV')
409 raise 410 raise
410 revisions = [] 411 revisions = []
411 for commit_hash, _ in step_result.stdout: 412 revision_hashes = step_result.stdout
413 if exclude_end:
414 revision_hashes = revision_hashes[:-1]
415 for commit_hash, _ in revision_hashes:
412 revisions.append(self.revision_class( 416 revisions.append(self.revision_class(
413 bisector=self, 417 bisector=self,
414 commit_hash=commit_hash, 418 commit_hash=commit_hash,
415 depot_name=depot_name, 419 depot_name=depot_name,
416 base_revision=base_revision)) 420 base_revision=base_revision))
417 return revisions 421 return revisions
418 422
419 def _revision_range_with_gitiles(self, start, end, depot_name, 423 def _revision_range_with_gitiles(self, start, end, depot_name,
420 base_revision=None, step_name=None): # pragma: no cover 424 base_revision=None, step_name=None): # pragma: no cover
421 """Returns a list of RevisionState objects between |start| and |end|. 425 """Returns a list of RevisionState objects between |start| and |end|.
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 }) 950 })
947 return revision_rows 951 return revision_rows
948 952
949 def _get_build_url(self): 953 def _get_build_url(self):
950 properties = self.api.m.properties 954 properties = self.api.m.properties
951 bot_url = properties.get('buildbotURL', 955 bot_url = properties.get('buildbotURL',
952 'http://build.chromium.org/p/chromium/') 956 'http://build.chromium.org/p/chromium/')
953 builder_name = urllib.quote(properties.get('buildername', '')) 957 builder_name = urllib.quote(properties.get('buildername', ''))
954 builder_number = str(properties.get('buildnumber', '')) 958 builder_number = str(properties.get('buildnumber', ''))
955 return '%sbuilders/%s/builds/%s' % (bot_url, builder_name, builder_number) 959 return '%sbuilders/%s/builds/%s' % (bot_url, builder_name, builder_number)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698