@NotNull
  public static HgRepository getInstance(@NotNull VirtualFile root, @NotNull Project project,
                                         @NotNull Disposable parentDisposable) {
    ProgressManager.checkCanceled();
    HgVcs vcs = HgVcs.getInstance(project);
    if (vcs == null) {
      throw new IllegalArgumentException("Vcs not found for project " + project);
    }
    HgRepositoryImpl repository = new HgRepositoryImpl(root, vcs);
    repository.setupUpdater();

    ReadAction.run(() -> {
      if (!Disposer.tryRegister(parentDisposable, repository)) {
        Disposer.dispose(repository);
      }
    });
    return repository;
  }
@NotNull
  public static HgRepository getInstance(@NotNull VirtualFile root, @NotNull Project project,
                                         @NotNull Disposable parentDisposable)