This is a major rework of the remote repository detection mechanism
within RBTools. The old implementation had a lot of issues, worst of
which was that there was a lot of inconsistency across different tool
implementations (for example, rbt post
had a lot of additional
detection code that wasn't shared with other tools).
In the new implementation, we first try to fetch remote repositories,
filtering by the configured repository name, or detected repository
path(s). If this returns a single result, we can immediately return
that. If that fails, it means we're in a situation where the configured
paths on the server are different from the local path (including any
mirror_path), and we need to match in a different way. Individual tools
may implement find_matching_server_repository
in order to do
tool-specific comparisons (which right now is done by SVN with
repository UUID and ClearCase with VOB UUID). This new method replaces
the old RepositoryInfo.find_server_repository_info
method, which
always felt super ugly and clunky. In lieu of that, RepositoryInfo
subclasses can implement update_from_remote
, which allows them to
include information from the remote repository or repository info
resource.
Commands which want to make use of the repository can now set the
needs_repository
attribute. In this case, the command initialization
will handle finding the remote repository and updating the
RepositoryInfo
appropriately. This corrects a couple issues where
commands were using the repository but forgetting to call the old
find_server_repository_info
, potentially ending up with incorrect
data. The setup-repo
command works a little differently because it
needs to potentially do that multiple times, but it uses the same
underlying mechanism to attempt to pre-filter the list of matching
repositories in a useful way.
This includes several other improvements and cleanups along the way: