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

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

Issue 2507613002: In rebaseline-cl, don't check for local file existence. (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
« 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 """ 70 """
71 builder_to_latest_build = {} 71 builder_to_latest_build = {}
72 for build in builds: 72 for build in builds:
73 if build.builder_name not in builder_to_latest_build: 73 if build.builder_name not in builder_to_latest_build:
74 builder_to_latest_build[build.builder_name] = build 74 builder_to_latest_build[build.builder_name] = build
75 elif build.build_number > builder_to_latest_build[build.builder_name ].build_number: 75 elif build.build_number > builder_to_latest_build[build.builder_name ].build_number:
76 builder_to_latest_build[build.builder_name] = build 76 builder_to_latest_build[build.builder_name] = build
77 return sorted(builder_to_latest_build.values()) 77 return sorted(builder_to_latest_build.values())
78 78
79 def changed_files(self, issue_number): 79 def changed_files(self, issue_number):
80 """Lists the files included in a CL, or None if this can't be determined . 80 """Lists the files included in a CL that are changed but not deleted.
81 81
82 File paths are sorted and relative to the repository root. 82 File paths are sorted and relative to the repository root.
83 """ 83 """
84 try: 84 try:
85 url = self._latest_patchset_url(issue_number) 85 url = self._latest_patchset_url(issue_number)
86 issue_data = self._get_json(url) 86 issue_data = self._get_json(url)
87 return sorted(issue_data['files']) 87 return sorted(path for path, file_change in issue_data['files'].iter items() if file_change['status'] != 'D')
88 except (urllib2.URLError, ValueError, KeyError): 88 except (urllib2.URLError, ValueError, KeyError):
89 _log.warning('Failed to list changed files for issue %s.', issue_num ber) 89 _log.warning('Failed to list changed files for issue %s.', issue_num ber)
90 return None 90 return None
91 91
92 def _latest_patchset_url(self, issue_number): 92 def _latest_patchset_url(self, issue_number):
93 issue_data = self._get_json(self._issue_url(issue_number)) 93 issue_data = self._get_json(self._issue_url(issue_number))
94 latest_patchset_number = issue_data["patchsets"][-1] 94 latest_patchset_number = issue_data["patchsets"][-1]
95 return self._patchset_url(issue_number, latest_patchset_number) 95 return self._patchset_url(issue_number, latest_patchset_number)
96 96
97 def _get_json(self, url): 97 def _get_json(self, url):
(...skipping 12 matching lines...) Expand all
110 return json.loads(contents) 110 return json.loads(contents)
111 except ValueError: 111 except ValueError:
112 _log.error('Invalid JSON: %s', contents) 112 _log.error('Invalid JSON: %s', contents)
113 raise 113 raise
114 114
115 def _issue_url(self, issue_number): 115 def _issue_url(self, issue_number):
116 return '%s/%s' % (BASE_CODEREVIEW_URL, issue_number) 116 return '%s/%s' % (BASE_CODEREVIEW_URL, issue_number)
117 117
118 def _patchset_url(self, issue_number, patchset_number): 118 def _patchset_url(self, issue_number, patchset_number):
119 return '%s/%s' % (self._issue_url(issue_number), patchset_number) 119 return '%s/%s' % (self._issue_url(issue_number), patchset_number)
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