Refactor SCM tool registration using a registry
Review Request #9724 — Created March 3, 2018 and discarded — Latest diff uploaded
Instead of registering SCM tools in the database, populate a registry
at startup. This allows for more flexibility for users to register and
unregister external tools.Things done:
- Rename keys in registry to match the names in SCM tools classes
- Created service.py file with API for registering/unregistering tools
- Created test_registration.py to test service.py
- RenamedTool
model toLegacyTool
- Created new classTool
which is not a model. Instantiated by passing
in an SCM tool name (string). This class has the same properties as
LegacyTool
but gets the SCM tool class from the registry.
- Renamedtool
field inRepository
model to_legacy_tool
and add a
scmtool_name
field. Created an evolution for this.
- Createdtool
property inRepository
which does a lazy migration
away fromLegacyTool
by checking the value ofscmtool_name
.
- Replace usages of the legacytool
to usescmtool_name
E.g.tool = LegacyTool.objects.get(name='Subversion')
to
scmtool_name='Subversion'
- RefactorRepositoryForm
to usescmtool_name
- Other misc refactoring to pass tests inscmtools
,hostingsvcs
,
webapi
,reviews
, anddiffviewer
- Addmigratescmtools.py
command.
- Add SCMToolHook extension and unit tests
Currently passing all tests in
scmtools
,hostingsvcs
,webapi
,
reviews
, anddiffviewer
.Tested
migratescmtools.py
:
- Add local repos at/admin/db/scmtools/repository/add/
- Since theRepositoryForm
usesscmtool_name
now, manually
update repos in Django shell to be "pre-migration"
- Check that reposcmtool_name
and_legacy_tool
fields are as
expected post-migrationUnit tests for SCMToolHook extension.
Diff Revision 7
This is not the most recent revision of the diff. The latest diff is revision 11. See what's changed.
setup.py |
---|
docs/manual/fixtures/initial_data.json |
---|
reviewboard/admin/fixtures/initial_evolution_schema.json |
---|
reviewboard/diffviewer/tests/test_forms.py |
---|
reviewboard/hostingsvcs/repository.py |
---|
reviewboard/hostingsvcs/tests/test_assembla.py |
---|
reviewboard/hostingsvcs/tests/test_beanstalk.py |
---|
reviewboard/hostingsvcs/tests/test_bitbucket.py |
---|
reviewboard/hostingsvcs/tests/test_codebasehq.py |
---|
reviewboard/hostingsvcs/tests/test_hosting_service_auth_form.py |
---|
reviewboard/hostingsvcs/tests/test_kiln.py |
---|
reviewboard/hostingsvcs/tests/test_unfuddle.py |
---|
reviewboard/reviews/management/commands/fill-database.py |
---|
reviewboard/reviews/tests/test_counters.py |
---|
reviewboard/reviews/tests/test_default_reviewer.py |
---|
reviewboard/reviews/tests/test_forms.py |
---|
reviewboard/reviews/tests/test_policy.py |
---|
reviewboard/scmtools/admin.py |
---|
reviewboard/scmtools/conditions.py |
---|
reviewboard/scmtools/forms.py |
---|