How to move merge-request between projects?

Recently we split a code repository in three others and we have moved the issues to the other repositories. But the merge-requests there’s no such feature (i.e move). I did some searches about the GitLab API for merge-requests but I didn’t see a clear shot how to copy at least the unresolved threads and comments (a.k.a notes) to the new repository merge-request.

We kept the git history then we can push the same branch to the new repositories but I would like to keep both pending discussions and threads solved in an automated way to prevent a manual copy&paste one-by-one.

Another idea was: reestablish the fork link between the repositories in order to target the original merge-request to the new ones. I’m not sure if it’s the best option. Any advice is welcome. Thanks!

Hi @amadeubarbosa

I don’t think this is possible. If you want to keep the comment history, your best bet might be to write a script that uses the notes api to copy the comments (notes) across.

1 Like

Thanks.
Yeah… I still try to identify all relevant fields for unresolved threads (for example), as far I already understood I need at least:

  • “type”: DiscussionNote
  • “body”
  • “attachment”
  • “author”:
  • “created_at”
  • “system”: false ← seems a good tip about all discussions created by humans
  • “noteable_type”: MergeRequest
  • “resolvable”
  • “resolved”
  • “resolved_by”
  • “resolved_at”
  • “confidential”

I started a snippet to explain how I’m doing: Semi-automatic steps to migrate merge-requests between projects in GitLab ($2130375) · Snippets · Snippets · GitLab

In particular, the public API documentation doesn’t explain about how to create diff notes, for example. But I just debug what the GitLab javascript was doing when I start threads and create a comment over a commit line in the changes tab.

It’s a very simple work yet but could help someone else. It solves my situation. It was difficult understand why some threads are not mapped as discussion, I dropped some comments in the code.

1 Like