The different commands in RBTools have lots of differerent needs. Some
of them interact only with your local repository, some of them interact
only with the server API, some do both, and some do neither. We've
traditionally had a few methods to handle things like setting up the API
or the SCMClient, but usage of these was inconsistent and resulted in a
lot of repeated boilerplate. Because of this and the history of RBTools
development, usage of all of this was somewhat inconsistent, with many
commands doing more or less than they really needed to do.
This change is the first of a couple to clean this up. Two new
attributes have been added to the base Command
class: needs_api
and
needs_scm_client
. Subclasses can set these to True
depending on
their needs, and then prior to main
being called, the initialization
process will set various attributes: api_client
, api_root
,
capabilities
, repository_info
, server_url
, and tool
.
This change handles most of the initialization process. The one major
remaining piece are the calls to find_server_repository_info
, which
will require some more involved changes (for example, short-cutting in
the case when REPOSITORY_NAME
or REPOSITORY_URL
are defined).