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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld.py

Issue 2237083002: In rebaseline-cl: add option to only rebaseline tests changed in the CL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 to communicate with Rietveld.""" 5 """Utility functions to communicate with Rietveld."""
6 6
7 import json 7 import json
8 import logging 8 import logging
9 import urllib2 9 import urllib2
10 10
(...skipping 30 matching lines...) Expand all
41 jobs = [] 41 jobs = []
42 for job in patchset_data['try_job_results']: 42 for job in patchset_data['try_job_results']:
43 if job['builder'] not in builder_names: 43 if job['builder'] not in builder_names:
44 continue 44 continue
45 jobs.append(Build( 45 jobs.append(Build(
46 builder_name=job['builder'], 46 builder_name=job['builder'],
47 build_number=job['buildnumber'])) 47 build_number=job['buildnumber']))
48 return filter_latest_jobs(jobs) 48 return filter_latest_jobs(jobs)
49 49
50 50
51 def changed_files(issue_number, web):
52 """Lists the files included in a CL, or None if this can't be determined.
53
54 File paths are sorted and relative to the repository root.
55 """
56 try:
57 url = _latest_patchset_url(issue_number, web)
58 issue_data = _get_json(url, web)
59 return sorted(issue_data['files'])
60 except (urllib2.URLError, ValueError, KeyError):
61 _log.warning('Failed to list changed files for issue %s.', issue_number)
62 return None
63
64
51 def _latest_patchset_url(issue_number, web): 65 def _latest_patchset_url(issue_number, web):
52 issue_data = _get_json(_issue_url(issue_number), web) 66 issue_data = _get_json(_issue_url(issue_number), web)
53 latest_patchset_number = issue_data["patchsets"][-1] 67 latest_patchset_number = issue_data["patchsets"][-1]
54 return _patchset_url(issue_number, latest_patchset_number) 68 return _patchset_url(issue_number, latest_patchset_number)
55 69
56 70
57 def _get_json(url, web): 71 def _get_json(url, web):
58 """Fetches JSON from a URL, and logs errors if the request was unsuccessful. 72 """Fetches JSON from a URL, and logs errors if the request was unsuccessful.
59 73
60 Raises: 74 Raises:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 )] 115 )]
102 116
103 117
104 def get_latest_try_job_results(issue_number, web): 118 def get_latest_try_job_results(issue_number, web):
105 url = _latest_patchset_url(issue_number, web) 119 url = _latest_patchset_url(issue_number, web)
106 patchset_data = _get_json(url, web) 120 patchset_data = _get_json(url, web)
107 results = {} 121 results = {}
108 for job in patchset_data['try_job_results']: 122 for job in patchset_data['try_job_results']:
109 results[job['builder']] = job['result'] 123 results[job['builder']] = job['result']
110 return results 124 return results
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/net/rietveld_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698