public static void checkout(Project project,
                              File target,
                              @NotNull Url url,
                              Revision revision,
                              Depth depth,
                              boolean ignoreExternals,
                              Listener listener,
                              WorkingCopyFormat selectedFormat) {
    String projectAbsolutePath = target.getAbsolutePath();
    String projectPath = FileUtilRt.toSystemIndependentName(projectAbsolutePath);

    CloneTask cloneTask = new CloneTask() {
      final Ref<Boolean> checkoutSuccessful = new Ref<>();

      @NotNull
      @Override
      public CloneTaskInfo taskInfo() {
        return new CloneTaskInfo(message("progress.title.check.out"),
                                 message("progress.title.check.out.cancel"),
                                 message("checkout.repository"),
                                 message("checkout.repository.tooltip"),
                                 message("checkout.repository.failed"),
                                 message("checkout.repository.canceled"),
                                 message("checkout.stop.message.title"),
                                 message("checkout.stop.message.description", url.toString()));
      }

      @NotNull
      @Override
      public CloneStatus run(@NotNull ProgressIndicator indicator) {
        WorkingCopyFormat format = selectedFormat == null ? UNKNOWN : selectedFormat;
        SvnVcs vcs = SvnVcs.getInstance(project);
        ProgressTracker handler = new CheckoutEventHandler(vcs, false, ProgressManager.getInstance().getProgressIndicator());
        indicator.setText(message("progress.text.checking.out", target.getAbsolutePath()));
        try {
          getFactory(vcs).createCheckoutClient()
            .checkout(Target.on(url), target, revision, depth, ignoreExternals, true, format, handler);
          checkoutSuccessful.set(Boolean.TRUE);

          return CloneStatus.SUCCESS;
        }
        catch (VcsException exception) {
          getApplication().invokeLater(() -> {
            showErrorDialog(message("message.text.cannot.checkout", exception.getMessage()), message("dialog.title.check.out"));
          });
          return CloneStatus.FAILURE;
        }
        finally {
          VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(target);
          if (vf != null) {
            vf.refresh(true, true, () -> getApplication().executeOnPooledThread(() -> notifyListener()));
          }
          else {
            notifyListener();
          }
        }
      }

      @RequiresBackgroundThread
      private void notifyListener() {
        notifyRootManagerIfUnderProject(project, target);
        if (listener != null) {
          if (!checkoutSuccessful.isNull()) {
            listener.directoryCheckedOut(target, SvnVcs.getKey());
          }
          listener.checkoutCompleted();
        }
      }
    };

    CloneableProjectsService.getInstance().runCloneTask(projectPath, cloneTask);
  }
public static void checkout(Project project,
                              File target,
                              @NotNull Url url,
                              Revision revision,
                              Depth depth,
                              boolean ignoreExternals,
                              Listener listener,
                              WorkingCopyFormat selectedFormat)