Write a script to associate MR creators by username after a BitBucket Server import
Current state
A customer imported a project from Bitbucket Server to GitLab (self-hosted). Due to network/compliance restrictions, they weren't able to have a direct connection to the original Bitbucket Server. To work around that, they created a proxy Bitbucket Server (clone of the original) that has a connection to the GitLab server and imported a tarball export from the original BitBucket server. However, the tarball export did not include emails. When import was run from the proxy to GitLab, the original MR creators were not assigned (as the assignment is done by matching emails) and the importer user was assigned as the MR creator for all MRs. Additionally, a note was added to the description of each one of the MRs specifying the original creator by the handle.
The customer is now using the imported project but desires that the MR assignments are reestablished.
Desired solution
Create a script that the customer can run one time on the GitLab server after the import to reassociate the MR creator assignments. This script would use the fact that the usernames listed as creators in the description filed are the same as their email address usernames (the part before the @
sign).