Add support for custom SCMTool-provided repository configuration forms.
Review Request #10809 — Created Dec. 4, 2019 and submitted — Latest diff uploaded
For a long time now, hosting services have had the ability to provide
custom authentication and repository information forms for the
repository configuration page, allowing them to gather information
needed to authenticate with hosting services, locate organization
details, project IDs, or anything else they needed.Plain repositories (those not backed by a hosting service) were stuck
with a standard repository form containing Path, Mirror Path, Raw File
URL, Username, and Password fields. SCMTools could show or hide some of
these fields through flags, but otherwise had very little control.This isn't good enough going forward, as we've finally found a need for
some custom UI for an in-progress SCMTool. Rather than bolt the field
onto the main form and control it through another flag (which we did
with Perforce's Ticket Auth and Git's Raw File URL fields in the past),
it's time to give SCMTools the same level of control that hosting
services have enjoyed.This change moves all support for those fields into a couple of new
subforms, one for authentication and one for repository details.
SCMTools by default use the standard form fields we've used in the past,
but can provide a custom form by settingSCMTool.auth_form
and
SCMTool.repository_form
to subclasses ofBaseSCMToolAuthForm
and
BaseSCMToolRepositoryForm
(or the "Standard" subclasses of each).
These can augment or replace the existing fields entirely.Since this is late in the life of Review Board 3.0.x, we're not going to
deprecate any old functionality. However, the plan is for 4.0 to
deprecate a handful of flags onSCMTool
, includingfield_help_text
,
supports_raw_file_urls
, andsupports_ticket_auth
, and require moving
to form subclasses to collect this information.
Unit tests passed.
Tested creating and configuring repositories of various types, using both
plain repositories and hosting services.