@CalledInAwt
  public static void refreshPassedFilesAndMoveToChangelist(
      @NotNull final Project project,
      final Collection<FilePath> directlyAffected,
      final Collection<VirtualFile> indirectlyAffected,
      final Consumer<Collection<FilePath>> targetChangelistMover) {
    final LocalFileSystem lfs = LocalFileSystem.getInstance();
    for (FilePath filePath : directlyAffected) {
      lfs.refreshAndFindFileByIoFile(filePath.getIOFile());
    }
    if (project.isDisposed()) return;

    final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
    if (!directlyAffected.isEmpty() && targetChangelistMover != null) {
      changeListManager.invokeAfterUpdate(
          new Runnable() {
            @Override
            public void run() {
              targetChangelistMover.consume(directlyAffected);
            }
          },
          InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE,
          VcsBundle.message("change.lists.manager.move.changes.to.list"),
          new Consumer<VcsDirtyScopeManager>() {
            @Override
            public void consume(final VcsDirtyScopeManager vcsDirtyScopeManager) {
              markDirty(vcsDirtyScopeManager, directlyAffected, indirectlyAffected);
            }
          },
          null);
    } else {
      markDirty(VcsDirtyScopeManager.getInstance(project), directlyAffected, indirectlyAffected);
    }
  }
 @NotNull
 private static FilePath rebasePath(
     @NotNull FilePath oldBase, @NotNull FilePath newBase, @NotNull FilePath path) {
   String relativePath =
       ObjectUtils.assertNotNull(FileUtil.getRelativePath(oldBase.getPath(), path.getPath(), '/'));
   return VcsUtil.getFilePath(newBase.getPath() + "/" + relativePath, path.isDirectory());
 }
 public static BeforeAfter<DiffContent> createBinaryDiffContents(
     final Project project, final Change change) throws VcsException {
   final FilePath filePath = ChangesUtil.getFilePath(change);
   try {
     return new BeforeAfter<DiffContent>(
         createBinaryFileContent(project, change.getBeforeRevision(), filePath.getName()),
         createBinaryFileContent(project, change.getAfterRevision(), filePath.getName()));
   } catch (IOException e) {
     throw new VcsException(e);
   }
 }
 private static SimpleDiffRequest createBinaryDiffRequest(
     final Project project, final Change change) throws VcsException {
   final FilePath filePath = ChangesUtil.getFilePath(change);
   final SimpleDiffRequest request = new SimpleDiffRequest(project, filePath.getPath());
   try {
     request.setContents(
         createBinaryFileContent(project, change.getBeforeRevision(), filePath.getName()),
         createBinaryFileContent(project, change.getAfterRevision(), filePath.getName()));
     return request;
   } catch (IOException e) {
     throw new VcsException(e);
   }
 }
 private static boolean directoryOrBinary(final Change change) {
   // todo instead for repository tab, filter directories (? ask remotely ? non leaf nodes)
   /*if ((change.getBeforeRevision() instanceof BinaryContentRevision) || (change.getAfterRevision() instanceof BinaryContentRevision)) {
     changesList.remove(i);
     continue;
   }*/
   final FilePath path = ChangesUtil.getFilePath(change);
   if (path.isDirectory()) {
     return !change.hasOtherLayers();
   }
   /*final FileType type = path.getFileType();
   if ((! FileTypes.UNKNOWN.equals(type)) && (type.isBinary())) {
     return true;
   }*/
   return false;
 }
 private static void correctListForRevision(
     final ProjectLevelVcsManager plVcsManager,
     final ContentRevision revision,
     final SVNChangelistClient client,
     final String name) {
   if (revision != null) {
     final FilePath path = revision.getFile();
     final AbstractVcs vcs = plVcsManager.getVcsFor(path);
     if (vcs != null && VCS_NAME.equals(vcs.getName())) {
       try {
         client.doAddToChangelist(new File[] {path.getIOFile()}, SVNDepth.EMPTY, name, null);
       } catch (SVNException e) {
         // left in default list
       }
     }
   }
 }
 @Override
 public boolean fileIsUnderVcs(FilePath path) {
   final ChangeListManager clManager = ChangeListManager.getInstance(myProject);
   final VirtualFile file = path.getVirtualFile();
   if (file == null) {
     return false;
   }
   return !SvnStatusUtil.isIgnoredInAnySense(clManager, file) && !clManager.isUnversioned(file);
 }
 private boolean isUnderOldDir(Change change, FilePath path) {
   if (change.getBeforeRevision() != null) {
     final boolean isUnder =
         FileUtil.isAncestor(
             path.getIOFile(), change.getBeforeRevision().getFile().getIOFile(), true);
     if (isUnder) {
       return true;
     }
   }
   if (change.getAfterRevision() != null) {
     final boolean isUnder =
         FileUtil.isAncestor(
             path.getIOFile(), change.getAfterRevision().getFile().getIOFile(), true);
     if (isUnder) {
       return isUnder;
     }
   }
   return false;
 }
 @Override
 public boolean fileExistsInVcs(FilePath path) {
   File file = path.getIOFile();
   try {
     SVNStatus status = createStatusClient().doStatus(file, false);
     if (status != null) {
       if (svnStatusIs(status, SVNStatusType.STATUS_ADDED)) {
         return status.isCopied();
       }
       return !(svnStatusIsUnversioned(status)
           || svnStatusIs(status, SVNStatusType.STATUS_IGNORED)
           || svnStatusIs(status, SVNStatusType.STATUS_OBSTRUCTED));
     }
   } catch (SVNException e) {
     //
   }
   return false;
 }