public void run()

in src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeleteCommand.java [51:86]


  public void run() throws Failure {
    try {
      DeleteProject.Input input = new DeleteProject.Input();
      input.force = force;
      input.preserve = preserveGitRepository;

      ProjectResource rsrc = new ProjectResource(projectState, user);
      preConditions.assertDeletePermission(rsrc);

      if (!yesReallyDelete) {
        throw new UnloggedFailure(
            String.format(
                "Really delete '%s'?\n"
                    + "This is an operation which permanently deletes data. This cannot be undone!\n"
                    + "If you are sure you wish to delete this project, re-run with the "
                    + "--yes-really-delete flag.\n",
                rsrc.getName()));
      }

      if (!force) {
        try {
          preConditions.assertHasOpenChanges(rsrc.getNameKey(), false);
        } catch (CannotDeleteProjectException e) {
          throw new UnloggedFailure(
              String.format(
                  "%s - To really delete '%s', re-run with the --force flag.",
                  e.getMessage(), rsrc.getName()));
        }
      }

      preConditions.assertCanBeDeleted(rsrc, input);
      deleteProject.doDelete(rsrc, input);
    } catch (RestApiException | IOException e) {
      throw die(e);
    }
  }