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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater.py

Issue 2496633002: W3C auto importer: Add a buildbot job link to CL description. (Closed)
Patch Set: Created 4 years, 1 month 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 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 """Fetches a copy of the latest state of a W3C test repository and commits. 5 """Fetches a copy of the latest state of a W3C test repository and commits.
6 6
7 If this script is given the argument --auto-update, it will also attempt to 7 If this script is given the argument --auto-update, it will also attempt to
8 upload a CL, triggery try jobs, and make any changes that are required for 8 upload a CL, triggery try jobs, and make any changes that are required for
9 new failing tests before committing. 9 new failing tests before committing.
10 """ 10 """
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 if self.git_cl.has_failing_try_results(try_results): 323 if self.git_cl.has_failing_try_results(try_results):
324 self.print_('CQ failed; aborting.') 324 self.print_('CQ failed; aborting.')
325 self.git_cl.run(['set-close']) 325 self.git_cl.run(['set-close'])
326 return False 326 return False
327 self.print_('## Update completed.') 327 self.print_('## Update completed.')
328 return True 328 return True
329 329
330 def _upload_cl(self): 330 def _upload_cl(self):
331 self.print_('## Uploading change list.') 331 self.print_('## Uploading change list.')
332 cc_list = self.get_directory_owners_to_cc() 332 cc_list = self.get_directory_owners_to_cc()
333 last_commit_message = self.check_run(['git', 'log', '-1', '--format=%B'] ) 333 description = self._cl_description()
334 commit_message = last_commit_message + 'TBR=qyearsley@chromium.org'
335 self.git_cl.run([ 334 self.git_cl.run([
336 'upload', 335 'upload',
337 '-f', 336 '-f',
338 '--rietveld', 337 '--rietveld',
339 '-m', 338 '-m',
340 commit_message, 339 description,
341 ] + ['--cc=' + email for email in cc_list]) 340 ] + ['--cc=' + email for email in cc_list])
342 341
342 def _cl_description(self):
343 description = self.check_run(['git', 'log', '-1', '--format=%B'])
344 build_link = self._build_link()
345 if build_link:
346 description += 'Build: %s\n\n' % build_link
347 description += 'TBR=qyearsley@chromium.org'
348 return description
349
350 def _build_link(self):
351 """Returns a link to a job, if running on buildbot."""
352 master_name = self.host.environ.get('BUILDBOT_MASTERNAME')
353 builder_name = self.host.environ.get('BUILDBOT_BUILDERNAME')
354 build_number = self.host.environ.get('BUILDBOT_BUILDNUMBER')
355 if not (master_name and builder_name and build_number):
356 return None
357 return 'https://build.chromium.org/p/%s/builders/%s/builds/%s' % (master _name, builder_name, build_number)
358
343 def get_directory_owners_to_cc(self): 359 def get_directory_owners_to_cc(self):
344 """Returns a list of email addresses to CC for the current import.""" 360 """Returns a list of email addresses to CC for the current import."""
345 self.print_('## Gathering directory owners emails to CC.') 361 self.print_('## Gathering directory owners emails to CC.')
346 directory_owners_file_path = self.finder.path_from_webkit_base( 362 directory_owners_file_path = self.finder.path_from_webkit_base(
347 'Tools', 'Scripts', 'webkitpy', 'w3c', 'directory_owners.json') 363 'Tools', 'Scripts', 'webkitpy', 'w3c', 'directory_owners.json')
348 with open(directory_owners_file_path) as data_file: 364 with open(directory_owners_file_path) as data_file:
349 directory_to_owner = self.parse_directory_owners(json.load(data_file )) 365 directory_to_owner = self.parse_directory_owners(json.load(data_file ))
350 out = self.check_run(['git', 'diff', 'origin/master', '--name-only']) 366 out = self.check_run(['git', 'diff', 'origin/master', '--name-only'])
351 changed_files = out.splitlines() 367 changed_files = out.splitlines()
352 return self.generate_email_list(changed_files, directory_to_owner) 368 return self.generate_email_list(changed_files, directory_to_owner)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 """Returns a dict mapping source to dest name for layout tests that have been renamed.""" 449 """Returns a dict mapping source to dest name for layout tests that have been renamed."""
434 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff- filter=R', '--name-status']) 450 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff- filter=R', '--name-status'])
435 renamed_tests = {} 451 renamed_tests = {}
436 for line in out.splitlines(): 452 for line in out.splitlines():
437 _, source_path, dest_path = line.split() 453 _, source_path, dest_path = line.split()
438 source_test = self.finder.layout_test_name(source_path) 454 source_test = self.finder.layout_test_name(source_path)
439 dest_test = self.finder.layout_test_name(dest_path) 455 dest_test = self.finder.layout_test_name(dest_path)
440 if source_test and dest_test: 456 if source_test and dest_test:
441 renamed_tests[source_test] = dest_test 457 renamed_tests[source_test] = dest_test
442 return renamed_tests 458 return renamed_tests
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698