WIP: Improve GitHub import branches performance

Open James Lopez requested to merge fix/gh-import-branches-performance into master

This will allow us to:

  • Creating MR diffs was timing out recently, so we couldn't even resume the import. Having this should help with performance.
  • Fix current MRs that have no actual branch associated and are throwing 500s
  • Fix MRs that have been updated upstream (so the diff has changed) but not locally
  • Performance should be improved as we won't be fetching the branch per MR

After this is merged we can then remove all (non-required) branches.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36288

What are the relevant issue numbers?

Edited by James Lopez