Implemented suppport for getrelatedchanges endpoint in gerrit module
The endpoint documentation can be found here:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-related-changes
This involved adding support for the command in gerrit_client and
gerrit_util and then incorporating functionality and testing into
the gerrit recipe module.
The reasoning for this is to be able to identify chained builds for
improved accuracy of the new test identification for the FLake
Endorser project.
Bug:1204163
Change-Id: Ic60c733540a9afd7ff159408b0ea9ad7aac078e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2928016
Commit-Queue: Marco Georgaklis <mgeorgaklis@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
diff --git a/gerrit_util.py b/gerrit_util.py
index 81d0f88..1f44a79 100644
--- a/gerrit_util.py
+++ b/gerrit_util.py
@@ -703,6 +703,12 @@
return ReadHttpJsonResponse(CreateHttpConn(host, path))
+def GetRelatedChanges(host, change, revision='current'):
+ """Gets the related changes for a given change and revision."""
+ path = 'changes/%s/revisions/%s/related' % (change, revision)
+ return ReadHttpJsonResponse(CreateHttpConn(host, path))
+
+
def AbandonChange(host, change, msg=''):
"""Abandons a Gerrit change."""
path = 'changes/%s/abandon' % change