Skip to content

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

isaac-philip
Copy link

Merge Trains Api additional support added :

  1. Status of Merge Request on Merge Train
  2. Add Merge Request to Merge Train

closes #2547

(can work to update the MR with docs till its reviewed/ required, thanks)

Copy link

codecov bot commented Mar 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.32%. Comparing base (378a836) to head (3ac6561).

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           
Flag Coverage Δ
api_func_v4 83.71% <100.00%> (-0.03%) ⬇️
cli_func_v4 84.71% <100.00%> (+0.02%) ⬆️
unit 90.22% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
gitlab/v4/objects/merge_trains.py 100.00% <100.00%> (ø)
gitlab/v4/objects/projects.py 98.92% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@isaac-philip
Copy link
Author

@nejch kindly take a look at this PR.

also if anybody else I should loop in here do share, thanks.

@isaac-philip
Copy link
Author

@JohnVillalovos please let us know for any changes needed before merge, thanks.

@JohnVillalovos JohnVillalovos requested a review from Copilot April 7, 2025 01:50
Copilot

This comment was marked as outdated.

@JohnVillalovos JohnVillalovos force-pushed the feat/merge_trains_additional branch from 51a93c1 to 7630232 Compare April 17, 2025 16:27
…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>
@JohnVillalovos JohnVillalovos force-pushed the feat/merge_trains_additional branch from 7630232 to 3ac6561 Compare June 7, 2025 15:04
@JohnVillalovos JohnVillalovos requested a review from Copilot June 7, 2025 15:05
Copy link

@Copilot Copilot AI left a 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 in projects.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()
Copy link
Preview

Copilot AI Jun 7, 2025

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.

Copy link
Member

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.

Comment on lines +12 to +13
+ :class:`gilab.v4.objects.ProjectMergeTrainMergeRequest`
+ :class:`gilab.v4.objects.ProjectMergeTrainMergeRequestManager`
Copy link
Preview

Copilot AI Jun 7, 2025

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'.

Suggested change
+ :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.

Copy link
Member

@JohnVillalovos JohnVillalovos left a 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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -46,6 +46,10 @@
"duration": 70,
}

merge_train_update = mr_content.copy()
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for new merge train APIs
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy