-
Notifications
You must be signed in to change notification settings - Fork 670
Feat/merge trains additional #2547 #3149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat/merge trains additional #2547 #3149
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3149 +/- ##
=======================================
Coverage 97.32% 97.32%
=======================================
Files 98 98
Lines 6057 6066 +9
=======================================
+ Hits 5895 5904 +9
Misses 162 162
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
@nejch kindly take a look at this PR. also if anybody else I should loop in here do share, thanks. |
@JohnVillalovos please let us know for any changes needed before merge, thanks. |
51a93c1
to
7630232
Compare
…dd mr Signed-off-by: Isaac Philip <4974658+isaac-philip@users.noreply.github.com>
…dd mr - test data modifications Signed-off-by: Isaac Philip <4974658+isaac-philip@users.noreply.github.com>
…dd mr - minor changes Signed-off-by: Isaac Philip <4974658+isaac-philip@users.noreply.github.com>
…dd mr - lint formatted by black Signed-off-by: Isaac Philip <4974658+isaac-philip@users.noreply.github.com>
…dd mr - docs added Signed-off-by: Isaac Philip <4974658+isaac-philip@users.noreply.github.com>
7630232
to
3ac6561
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for two new Merge Train API operations: querying the status of a merge request on a merge train and adding a merge request to a merge train.
- Define
ProjectMergeTrainMergeRequest
and its manager with GET/POST support - Wire the new manager into the
ProjectMergeTrain
object and expose the import inprojects.py
- Add unit tests and update documentation for the new endpoints
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
gitlab/v4/objects/merge_trains.py | Added ProjectMergeTrainMergeRequest and its manager; wired merge_requests on ProjectMergeTrain |
gitlab/v4/objects/projects.py | Exposed ProjectMergeTrainManager import on Project |
tests/unit/objects/test_merge_trains.py | Added fixtures and tests for GET/POST operations on merge train merge requests |
docs/gl_objects/merge_trains.rst | Documented the new classes and examples for merge train merge requests |
Comments suppressed due to low confidence (2)
tests/unit/objects/test_merge_trains.py:99
- [nitpick] The test name uses plural 'merge_trains' while the related test below is named 'test_merge_train_add_merge_request'. Consider renaming for consistency.
def test_merge_trains_status_merge_request(
gitlab/v4/objects/projects.py:67
- This import is not referenced directly in this file and will trigger a lint unused-import error. Reintroduce '# noqa: F401' to suppress the false-positive lint warning.
from .merge_trains import ProjectMergeTrainManager
@@ -46,6 +46,10 @@ | |||
"duration": 70, | |||
} | |||
|
|||
merge_train_update = mr_content.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using dict.copy() here performs a shallow copy, so nested structures (like the 'pipeline' dict) remain shared with mr_content and may be mutated unexpectedly. Consider using copy.deepcopy() to isolate test data changes.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good idea. Since line 51 would modify the underlying dict.
+ :class:`gilab.v4.objects.ProjectMergeTrainMergeRequest` | ||
+ :class:`gilab.v4.objects.ProjectMergeTrainMergeRequestManager` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the module path: 'gilab' should be spelled 'gitlab'.
+ :class:`gilab.v4.objects.ProjectMergeTrainMergeRequest` | |
+ :class:`gilab.v4.objects.ProjectMergeTrainMergeRequestManager` | |
+ :class:`gitlab.v4.objects.ProjectMergeTrainMergeRequest` | |
+ :class:`gitlab.v4.objects.ProjectMergeTrainMergeRequestManager` |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @isaac-philip
Just a few minor changes requested.
Also it could be squashed down to one commit most likely. That can be done when it is merged or you can do it when you update. Either works.
_update_method: UpdateMethod = UpdateMethod.POST | ||
|
||
_update_attrs = RequiredOptional( | ||
optional=("sha", "squash", "when_pipeline_succeeds") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should auto_merge
be added?
https://docs.gitlab.com/api/merge_trains/#add-a-merge-request-to-a-merge-train
@@ -46,6 +46,10 @@ | |||
"duration": 70, | |||
} | |||
|
|||
merge_train_update = mr_content.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good idea. Since line 51 would modify the underlying dict.
Merge Trains Api additional support added :
closes #2547
(can work to update the MR with docs till its reviewed/ required, thanks)