Feat/merge trains additional #2547#3381
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3381 +/- ##
==========================================
+ Coverage 92.16% 95.77% +3.61%
==========================================
Files 100 100
Lines 6125 6152 +27
==========================================
+ Hits 5645 5892 +247
+ Misses 480 260 -220
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
|
@JohnVillalovos kindly have a look for same set of changes with earlier MR rebased on latest. thanks. |
Sorry, something went wrong.
There was a problem hiding this comment.
Pull request overview
Adds support for GitLab’s merge train merge-request endpoints (MR status on merge train + adding an MR to a merge train) to python-gitlab, along with unit tests and docs, addressing issue #2547.
Changes:
- Extend
ProjectMergeTrainManagerto supportget()and add a nestedmerge_requestsmanager for merge train MR status/add-to-train endpoints. - Add unit tests covering merge train listing, MR status retrieval, and adding an MR to a merge train.
- Document the new merge train MR classes/managers and provide usage examples.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
gitlab/v4/objects/merge_trains.py |
Adds merge train MR REST object + manager; enables get() on merge trains. |
gitlab/v4/objects/projects.py |
Adjusts import for merge trains manager (lint-sensitive). |
tests/unit/objects/test_merge_trains.py |
Adds fixtures and tests for new merge train MR endpoints. |
docs/gl_objects/merge_trains.rst |
Documents new merge train MR objects/managers and examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
|
@JohnVillalovos appreciate the review, kindly check if it looks good now after review changes. any more suggestions also I would be happy to rectify sooner. thank you. |
Sorry, something went wrong.
Thanks. I will try to find time and motivation to review this. Hopefully this week. |
Sorry, something went wrong.
|
As a note. It would be nice if it was squashed down to maybe 1 commit? Less than 12 sounds like a good start. |
Sorry, something went wrong.
|
@isaac-philip Now it is 13 commits. Let me know if you need help squashing |
Sorry, something went wrong.
b2e70cc to
f1b8827
Compare
April 19, 2026 12:57
|
Hello @JohnVillalovos , have made the change as requested for single commit, thanks. |
Sorry, something went wrong.
Signed-off-by: Isaac Philip <4974658+isaac-philip@users.noreply.github.com>
f1b8827 to
64e017d
Compare
April 19, 2026 16:26
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
|
@isaac-philip Please make the commit message a bit more informative Currently it is basically just a subject line that says:
It is hard to tell from the message what is being added, what “status” refers to, or whether this is about merge train objects, merge train merge requests, or functional test coverage. Also the PR number should not be in the commit message. |
Sorry, something went wrong.
|
I was reviewing this with the help of Claude Code. I ended up coming up with this. The nesting of # ProjectDeploymentMergeRequest — deployment id IS in the path:
_path = "/projects/{project_id}/deployments/{deployment_id}/merge_requests"
_from_parent_attrs = {"deployment_id": "id", "project_id": "project_id"}
# ProjectMergeRequestDiffVersion — MR iid IS in the path:
_path = "/projects/{project_id}/merge_requests/{mr_iid}/versions"
_from_parent_attrs = {"project_id": "project_id", "mr_iid": "iid"}In both cases project.merge_trains.get(1, lazy=True).merge_requests.get(5) # GET /projects/1/merge_trains/merge_requests/5
project.merge_trains.get(999, lazy=True).merge_requests.get(5) # GET /projects/1/merge_trains/merge_requests/5 (identical)The The GitLab API endpoint # projects.py
merge_trains: ProjectMergeTrainManager
merge_train_merge_requests: ProjectMergeTrainMergeRequestManager
# merge_trains.py
class ProjectMergeTrainMergeRequestManager(...):
_path = "/projects/{project_id}/merge_trains/merge_requests"
_from_parent_attrs = {"project_id": "id"} # "id" from Project directlyUsage becomes What do you think @isaac-philip ? |
Sorry, something went wrong.
closes #2547