Bitbucket import failure when importing MR with fork
Summary
We have some occurrences of the error Validation failed: Branch conflict You can't use same project/branch for source and target for projects imported via the bitbucket cloud importer. This is due to pull requests on bitbucket which have a different target and source project (i.e. a fork). When importing such pull requests into gitlab, the validation fails because the forked project doesn't exist.
This also probably leads to errors such as
Validation failed: Validate branches Another open merge request already exists for this source branch: !1
Possible fixes
We should add a check in lib/gitlab/bitbucket_import/importers/pull_requests_importer.rb or lib/gitlab/bitbucket_import/importers/pull_request_importer.rb to return early if this is the case. Check if the response contains source and target project and do not import if these are the same.
Edited by Madelein van Niekerk