public static boolean updateRepoToInCurrentThread(final @NotNull Project project,
                                                    final @NotNull VirtualFile repository,
                                                    final @NotNull @NonNls String targetRevision,
                                                    final boolean clean) {
    final HgUpdateCommand hgUpdateCommand = new HgUpdateCommand(project, repository);
    hgUpdateCommand.setRevision(targetRevision);
    hgUpdateCommand.setClean(clean);
    HgCommandResult result = hgUpdateCommand.execute();
    new HgConflictResolver(project).resolve(repository);
    boolean success = !HgErrorUtil.isCommandExecutionFailed(result);
    boolean hasUnresolvedConflicts = HgConflictResolver.hasConflicts(project, repository);
    if (!success) {
      new HgCommandResultNotifier(project)
        .notifyError(UPDATE_ERROR, result, "", HgBundle.message("hg4idea.update.failed"));
    }
    else if (hasUnresolvedConflicts) {
      new VcsNotifier(project)
        .notifyImportantWarning(UPDATE_UNRESOLVED_CONFLICTS_ERROR,
                                HgBundle.message("hg4idea.update.unresolved.conflicts"),
                                HgBundle.message("hg4idea.update.warning.merge.conflicts", repository.getPath()));
    }
    getRepositoryManager(project).updateRepository(repository);
    HgUtil.markDirectoryDirty(project, repository);
    return success;
  }
public static boolean updateRepoToInCurrentThread(final @NotNull Project project,
                                                    final @NotNull VirtualFile repository,
                                                    final @NotNull @NonNls String targetRevision,
                                                    final boolean clean)