Make RBTools command initialization easier and more consistent.
Review Request #11480 — Created Feb. 22, 2021 and submitted — Latest diff uploaded
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 baseCommandclass:needs_apiand
needs_scm_client. Subclasses can set these toTruedepending on
their needs, and then prior tomainbeing called, the initialization
process will set various attributes:api_client,api_root,
capabilities,repository_info,server_url, andtool.This change handles most of the initialization process. The one major
remaining piece are the calls tofind_server_repository_info, which
will require some more involved changes (for example, short-cutting in
the case whenREPOSITORY_NAMEorREPOSITORY_URLare defined).
- Smoke tested basic functionality for all changed commands.
- Verified
rbt patchbehavior was correct with both ID and full URL
(ID only and ID + diff revision) arguments. Checked that
rbt patch --printdid not initialize any repository support. - Verified
rbt landbehavior was correct with both ID and full URL
--review-request-idoption. - Checked that
rbt status --alldid not initialize any repository
support.