Commit cae728d5 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[wpt-sync] Tweak Gerrit search queries

* Also fetch DETAILED_ACCOUNTS in query_cl to make sure we have owner
  info (altough currently the only user of that method doesn't need it).
* Do not fetch DETAILED_LABELS as we never use it.
* Extract query options into a constant now that two methods use the
  same options.
* Exclude WIP CLs in query_exportable_open_cls and get up to 500 CLs to
  reduce the chance of missing in-flight exportable CLs.

Change-Id: I308f6d8e730940b15f40fdb0aa2d61f9b86d6369
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626301
Auto-Submit: Robert Ma <robertma@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662828}
parent c514fc9b
......@@ -14,6 +14,8 @@ from blinkpy.w3c.common import CHROMIUM_WPT_DIR, is_file_exportable
_log = logging.getLogger(__name__)
URL_BASE = 'https://chromium-review.googlesource.com'
# https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#query-options
QUERY_OPTIONS = 'o=CURRENT_FILES&o=CURRENT_REVISION&o=COMMIT_FOOTERS&o=DETAILED_ACCOUNTS'
class GerritAPI(object):
......@@ -52,8 +54,7 @@ class GerritAPI(object):
def query_cl(self, change_id):
"""Quries a commit information from Gerrit."""
path = ('/changes/chromium%2Fsrc~master~{}?'
'o=CURRENT_FILES&o=CURRENT_REVISION&o=COMMIT_FOOTERS').format(change_id)
path = '/changes/chromium%2Fsrc~master~{}?{}'.format(change_id, QUERY_OPTIONS)
try:
cl_data = self.get(path)
except NetworkTimeout:
......@@ -65,10 +66,9 @@ class GerritAPI(object):
cl = GerritCL(data=cl_data, api=self)
return cl
def query_exportable_open_cls(self, limit=200):
path = ('/changes/?q=project:\"chromium/src\"+branch:master+status:open'
'&o=CURRENT_FILES&o=CURRENT_REVISION&o=COMMIT_FOOTERS'
'&o=DETAILED_ACCOUNTS&o=DETAILED_LABELS&n={}').format(limit)
def query_exportable_open_cls(self, limit=500):
path = ('/changes/?q=project:\"chromium/src\"+branch:master+is:open+'
'-is:wip&{}&n={}').format(QUERY_OPTIONS, limit)
# The underlying host.web.get_binary() automatically retries until it
# times out, at which point NetworkTimeout is raised.
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment