Skip to content

Support GitLab "dependent merge request" feature #1402

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
bagedevimo opened this issue Feb 23, 2025 · 1 comment
Open

Support GitLab "dependent merge request" feature #1402

bagedevimo opened this issue Feb 23, 2025 · 1 comment
Labels
gitlab Relates to integration with GitLab

Comments

@bagedevimo
Copy link

bagedevimo commented Feb 23, 2025

GitLab's merge requests support depending on another merge request as a core aspect of the PR. It can only be added after both MRs have been created, as seperate API call, similar to how dependant descriptions are updated in the existing client.py.

# As the description may include the reference to this PR itself (in case of a chain of >=2 PRs),
# let's update the PR description after it's already created (so that we know the current PR's number).

https://docs.gitlab.com/api/merge_requests/#create-a-merge-request-dependency is the relevant API call, and it looks like it would be safe to call to even if the existing dependency exists as it returns 409 in this case.

I'd be willing to give this a go, but I have no idea how to handle this in the client.py such that it's be generic across Github / GitLab?

@bagedevimo bagedevimo changed the title Support GitLab "dependant merge request" feature Support GitLab "dependent merge request" feature Feb 23, 2025
@PawelLipski PawelLipski added the gitlab Relates to integration with GitLab label Feb 23, 2025
@PawelLipski
Copy link
Collaborator

Hey, nice idea — I didn't know GitLab supports that 🤔

I think you could do the following things:

  1. add a new abstract method link_dependent_pull_requests in CodeHostingClient
  2. implement this method properly with an endpoint call in GitLabClient
  3. add an empty implementation in GitHubClient
  4. in MacheteClient.retarget_pull_request add a call to self.code_hosting_client.link_dependent_pull_requests(..., ...) after a call to self.code_hosting_client.set_base_of_pull_request

Lemme know if you need any assistance! and pls remember to open a PR to develop (not master)

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

No branches or pull requests

2 participants