Reputation: 7970
Gerrit rest api has changes endpoint and there's a submitted_together
option. In python, it would go something like this;
def get_changes_submitted_together(rest, changeid):
try:
return rest.get(f"/changes/{changeid}/submitted_together?o=NON_VISIBLE_CHANGES&o=CURRENT_REVISION")
except requests.exceptions.HTTPError:
raise RuntimeError(f"Provided change ({changeid}) cannot be found on remote gerrit server.")
Now, If i do have a commit chain that has 10 commits and i call the endpoint with change id that is in middle of that chain, this endpoints returns only the one i asked for and its parent commits, not the child commits. Makes sense ofcourse since if i would now go to gerrit ui and merged that particular middle commit, children would still be left unmerged.
Is there any way via gerrit rest api to get the whole "relation" chain from first to last by providing any of the commit's change ids ?
I have done this previously with iterating all open open change requests, getting their parent and iterating down until the parent is the commit in the branch its been intended to be merged to. However, this is a bit of brute force approach.
I could ofcourse check the local branch and get the chain information from it but i might have a usecase where the whole commit chain not available in local git repository, only as a review in remote gerrit server..
Any suggestions ?
Upvotes: 0
Views: 1783
Reputation: 30878
'GET /changes/{change-id}/revisions/{revision-id}/related'
change-id
and the corresponding revision-id
can be any one in the chain. I think in your case revision-id
can always be current
.
Upvotes: 1