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

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

Issue 1836243002: Reland of Use the crrev recipe module to fetch commit hashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 8 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 depot_config 10 from . import depot_config
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 Args: 141 Args:
142 rev (str): A commit hash or commit position number. 142 rev (str): A commit hash or commit position number.
143 143
144 Returns: 144 Returns:
145 A 40-digit git commit hash string. 145 A 40-digit git commit hash string.
146 """ 146 """
147 if self._is_sha1(rev): # pragma: no cover 147 if self._is_sha1(rev): # pragma: no cover
148 return rev 148 return rev
149 if rev.isdigit(): 149 if rev.isdigit():
150 return self._api.m.commit_position.chromium_hash_from_commit_position(rev) 150 commit_position = self._api.m.commit_position.construct(
151 branch='refs/heads/master', value=rev)
152 try:
153 return self._api.m.crrev.to_commit_hash(commit_position)
154 except self.api.m.step.StepFailure: # pragma: no cover
155 self.surface_result('BAD_REV')
156 raise
151 self.surface_result('BAD_REV') # pragma: no cover 157 self.surface_result('BAD_REV') # pragma: no cover
152 raise self.api.m.step.StepFailure( 158 raise self.api.m.step.StepFailure(
153 'Invalid input revision: %r' % (rev,)) # pragma: no cover 159 'Invalid input revision: %r' % (rev,)) # pragma: no cover
154 160
155 @staticmethod 161 @staticmethod
156 def _is_sha1(s): 162 def _is_sha1(s):
157 return bool(re.match('^[0-9A-Fa-f]{40}$', s)) 163 return bool(re.match('^[0-9A-Fa-f]{40}$', s))
158 164
159 def significantly_different( 165 def significantly_different(
160 self, list_a, list_b, 166 self, list_a, list_b,
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 }) 914 })
909 return revision_rows 915 return revision_rows
910 916
911 def _get_build_url(self): 917 def _get_build_url(self):
912 properties = self.api.m.properties 918 properties = self.api.m.properties
913 bot_url = properties.get('buildbotURL', 919 bot_url = properties.get('buildbotURL',
914 'http://build.chromium.org/p/chromium/') 920 'http://build.chromium.org/p/chromium/')
915 builder_name = urllib.quote(properties.get('buildername', '')) 921 builder_name = urllib.quote(properties.get('buildername', ''))
916 builder_number = str(properties.get('buildnumber', '')) 922 builder_number = str(properties.get('buildnumber', ''))
917 return '%sbuilders/%s/builds/%s' % (bot_url, builder_name, builder_number) 923 return '%sbuilders/%s/builds/%s' % (bot_url, builder_name, builder_number)
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/__init__.py ('k') | scripts/slave/recipe_modules/auto_bisect/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698