I succeeded creating MR !2 using git-remote hg.

For other people, here are the steps I needed to take on ubuntu. Suppose I had a PR from branch my_pr_branch to target_branch on bitbucket. My user account on both bitbucket and gitlab is peci1. These steps require manually forking the gitlab repo before and having an SSH key set for your user/fork.

sudo pip install git-remote-hg
git clone https://gitlab.com/libeigen/eigen.git
cd eigen
git remote add hg hg::https://pe...@bitbucket.org/eigen/eigen
git remote add hg-peci1 hg::https://pe...@bitbucket.org/peci1/eigen
git remote add peci1 g...@gitlab.com:peci1/eigen.git
git fetch hg
git fetch hg-peci1
git fetch peci1
git checkout --track origin/target_branch
git checkout -b my_pr_branch
git log hg/branches/target_branch..hg-peci1/branches/my_pr_branch  # here you'll see hashes of all commits you made on this PR branch

# for each listed commit (from oldest to newest):
git cherry-pick <COMMIT_HASH>
git commit --amend --author="Martin Pecka <pe...@seznam.cz>"  # the import changed my name to Unknown, so I changed it back

git push peci1 my_pr_branch
# send the Merge request

Dne 05. 12. 19 v 9:23 Gael Guennebaud napsal(a):

There are indeed quite a lot of open PR on bitbucket, and writing a script to automatically migrate them on GitLab would have taken too much effort. There are two options:

1 - either the PR author, or anyone else, redo the PRs he/she care about on gitlab by hand and close the bitbucket PR with a respective link (through raw diff/patch files, or maybe git-remote-hg if this tools can fetch selected changesets)

2 - for simple PR that are unlikely to produce conflicts, we can also continue the discussions on bitbucket and once ready an Eigen maintainer will do the merge by hand (we used to do that quite often anyways)

Any volunteer to write a little script adding such instruction to every open PR? You can use my PR archiving script as a basis to see how to loop over all PR: https://gitlab.com/ggael/bitbucket-migration-tools/blob/master/archive_pullrequests.py

Martin Pecka
Martin Pecka

Reply via email to