Skip to content

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)

@codecov
Copy link

codecov bot commented Mar 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.75%. Comparing base (378a836) to head (8c4720b).
⚠️ Report is 83 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3149      +/-   ##
==========================================
- Coverage   97.32%   95.75%   -1.57%     
==========================================
  Files          98       98              
  Lines        6057     6059       +2     
==========================================
- Hits         5895     5802      -93     
- Misses        162      257      +95     
Flag Coverage Δ
api_func_v4 83.72% <87.50%> (-0.02%) ⬇️
cli_func_v4 78.70% <90.62%> (-5.99%) ⬇️
unit 90.21% <100.00%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
gitlab/_version.py 100.00% <100.00%> (ø)
gitlab/cli.py 91.09% <100.00%> (-8.91%) ⬇️
gitlab/client.py 98.55% <100.00%> (-0.19%) ⬇️
gitlab/const.py 100.00% <100.00%> (ø)
gitlab/utils.py 98.59% <100.00%> (ø)
gitlab/v4/cli.py 69.70% <100.00%> (-22.15%) ⬇️
gitlab/v4/objects/ci_lint.py 87.87% <100.00%> (-12.13%) ⬇️
gitlab/v4/objects/jobs.py 82.55% <100.00%> (ø)
gitlab/v4/objects/merge_trains.py 100.00% <100.00%> (ø)
gitlab/v4/objects/notes.py 100.00% <100.00%> (ø)
... and 4 more

... and 7 files with indirect coverage changes

🚀 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

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

"duration": 70,
}

merge_train_update = mr_content.copy()
Copy link

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.

Copy link
Author

Choose a reason for hiding this comment

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

made the change

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

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
Author

Choose a reason for hiding this comment

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

made the change

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.

Copy link
Author

Choose a reason for hiding this comment

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

added

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

@github-actions
Copy link

This Pull Request (PR) was marked stale because it has been open 90 days with no activity. Please remove the stale label or comment on this PR. Otherwise, it will be closed in 15 days.

@github-actions github-actions bot added the stale label Oct 17, 2025
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

This PR was closed because it has been marked stale for 15 days with no activity. If this PR is still valid, please re-open.

@github-actions github-actions bot closed this Nov 2, 2025
JohnVillalovos and others added 9 commits January 18, 2026 23:20
There was an error in the type-hints that was detected when updating
to mypy 1.16.0

The error was:
  $ mypy
  gitlab/v4/cli.py:411: error: Argument 1 to "cls_to_gitlab_resource" has incompatible type "type[Any]"; expected "RESTObject"  [arg-type]
  Found 1 error in 1 file (checked 246 source files)
Also update the `stale` job to close issues with no activity, unless
they are assigned to someone.
semantic-release and others added 27 commits January 18, 2026 23:20
For the: "Publish package distributions to GitHub Releases" use the
correct `secrets.RELEASE_GITHUB_TOKEN`. Before it was using
`secrets.GITHUB_TOKEN`

The other steps are already using `secrets.RELEASE_GITHUB_TOKEN`

Closes: python-gitlab#3288
…on-gitlab#3218)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
BREAKING CHANGE: GraphQL.execute() no longer accepts graphql.Source
…on-gitlab#3321)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@JohnVillalovos
Copy link
Member

This was already closed. I re-opened it but it can not be rebased due to conflicts. I will close this again. @isaac-philip Feel free to open a new PR if you want to continue on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for new merge train APIs

8 participants