Extract the repository deletion logic so it becomes reusable

The code that deletes a repository is generally quite robust and
as such it will be very useful for the pull-replication plugin.
However, the logic is heavily baked into the plugin itself;
it requires archiving settings read from the plugin config, and
deletion listeners to notify downstream systems - both are not
relevant to the pull-replication plugin (or anything else that
might want to just delete a repo).

Extract the repo deletion logic into a `RepositoryDelete` class,
free from any nuances of the delete-project plugin itself, so it
can be reused. The `FilesystemDeleteHandler` is now essentially
delegating everything into that class. I've also taken the
liberty to add a couple of missing tests for the notifying of
downstream systems through the deletion listeners.

Bug: Issue 16730
Change-Id: Ib28dbed344ef8a419cf7c318d0e87aadd7dadd5e
4 files changed
tree: 7827534424dbf5b4e89b952391795513626460f9
  1. src/
  2. web/
  3. .bazelignore
  4. .gitignore
  5. BUILD
  6. LICENSE
  7. README.md
README.md

Delete project plugin for Gerrit Code Review

A plugin which allows projects to be deleted from Gerrit via an SSH command, REST API or the Project settings screen.

Build Status

JavaScript Plugin Development

For running unit tests execute:

bazel test --test_output=all //plugins/delete-project/web:karma_test

For checking or fixing eslint formatter problems run:

bazel test //plugins/delete-project/web:lint_test
bazel run //plugins/delete-project/web:lint_bin -- --fix "$(pwd)/plugins/delete-project/web"

For testing the plugin with Gerrit FE Dev Helper build the JavaScript bundle and copy it to the plugins/ folder:

bazel build //plugins/delete-project/web:gr-delete-repo
cp -f bazel-bin/plugins/delete-project/web/gr-delete-repo.js plugins/

and let the Dev Helper redirect from .+/plugins/delete-project/static/gr-delete-repo.js to http://localhost:8081/plugins_/gr-delete-repo.js.