Split resolveRepositories code
Created by: asdine
With the addition of version contexts, the resolveRepositories
function became bloated and hard to read.
This PR tries to simplify it by splitting it into multiple functions, but since all of these functions require and modify the same variables, I instead created a type containing all of the shared state and created methods.
Let me know if you have ideas for improvement or even other design ideas.