reposource: ParseConfig function to simplify callers
Created by: keegancsmith
RepoSource is only used by reposourceCloneURLToRepoName in the graphqlbackend. It uses it for resolving submodules and repository redirects. Previously we created a List* for each external service type in the ExternalServices store. These functions are also only used by reposourceCloneURLToRepoName.
This commit simplifies this logic by using extsvc.ParseConfig and listing all external services rather than individually by type.
This also fixes some bugs. For example previously this functionality did not work for Bitbucket Cloud or Other external services (since the code forgot to call it).
We do change the order in which we check external services. However, given we match on hostnames in the clone URL it shouldn't affect functionality.
As we scale out external services this approach will no longer work. However, that requires more work. This commit helps us along that path since it reduces the coupling we had.
Note: The OtherExternalServiceConnection also uses its repo source, but doesn't need to. That is not solved in this commit.
Co-Author: @tsenart