Changeset 255218 in webkit
- Timestamp:
- Jan 27, 2020 5:46:47 PM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/BuildSlaveSupport/ews-app/ews/common/bugzilla.py
r246082 r255218 75 75 76 76 @classmethod 77 def _get_commit_queue_patches_from_bug(cls, bug_id): 78 if not util.is_valid_id(bug_id): 79 _log.warn('Invalid bug id: "{}"'.format(bug_id)) 80 return [] 81 82 bug_url = '{}rest/bug/{}/attachment'.format(config.BUG_SERVER_URL, bug_id) 83 api_key = os.getenv('BUGZILLA_API_KEY', None) 84 if api_key: 85 bug_url += '?api_key={}'.format(api_key) 86 bug = util.fetch_data_from_url(bug_url) 87 if not bug: 88 return [] 89 bug_json = bug.json().get('bugs') 90 if not bug_json or len(bug_json) == 0: 91 return [] 92 93 commit_queue_patches = [] 94 for patch_json in bug_json.get(str(bug_id)): 95 if cls._is_patch_cq_plus(patch_json) == 1: 96 commit_queue_patches.append(patch_json.get('id')) 97 98 return commit_queue_patches 99 100 @classmethod 101 def _is_patch_cq_plus(cls, patch_json): 102 if not patch_json: 103 return -1 104 105 for flag in patch_json.get('flags', []): 106 if flag.get('name') == 'commit-queue' and flag.get('status') == '+': 107 return 1 108 return 0 109 110 @classmethod 77 111 def file_path_for_patch(cls, patch_id): 78 112 if not os.path.exists(config.PATCH_FOLDER): … … 86 120 #TODO: add security bugs support here. 87 121 return ids_needing_review 122 123 @classmethod 124 def get_list_of_patches_for_commit_queue(cls): 125 bug_ids_for_commit_queue = set(BugzillaBeautifulSoup().fetch_bug_ids_for_commit_queue()) 126 ids_for_commit_queue = [] 127 for bug_id in bug_ids_for_commit_queue: 128 ids_for_commit_queue.extend(cls._get_commit_queue_patches_from_bug(bug_id)) 129 return ids_for_commit_queue 88 130 89 131 … … 144 186 return self._parse_attachment_ids_request_query(self._load_query(review_queue_url), since) 145 187 188 def fetch_bug_ids_for_commit_queue(self): 189 commit_queue_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=commit-queue%2B&order=Last+Changed" 190 soup = BeautifulSoup(self._load_query(commit_queue_url)) 191 # The contents of the <a> inside the cells in the first column happen 192 # to be the bug id. 193 return [int(bug_link_cell.find("a").string) 194 for bug_link_cell in soup('td', "first-child")] 195 146 196 def _load_query(self, query): 147 197 self.authenticate() -
trunk/Tools/ChangeLog
r255179 r255218 1 2020-01-27 Aakash Jain <aakash_jain@apple.com> 2 3 [ews] Add method to fetch cq+ patches from Bugzilla 4 https://bugs.webkit.org/show_bug.cgi?id=206774 5 6 Reviewed by Jonathan Bedard. 7 8 * BuildSlaveSupport/ews-app/ews/common/bugzilla.py: 9 (Bugzilla._get_commit_queue_patches_from_bug): Method to get cq+ patches for a given bug. 10 (Bugzilla._is_patch_cq_plus): Method to check if patch has cq+ flag set. 11 (Bugzilla.get_list_of_patches_for_commit_queue): Method to fetch list of cq+ patches from Bugzilla. 12 (BugzillaBeautifulSoup.fetch_bug_ids_for_commit_queue): 13 1 14 2020-01-27 Noam Rosenthal <noam@webkit.org> 2 15
Note: See TracChangeset
for help on using the changeset viewer.