private static void add(@NotNull ProjectLevelVcsManager vcsManager,
                          @NotNull FilesAndDirs filesAndDirs,
                          @NotNull FilePath filePath,
                          boolean withParentDirectory) {
    VcsRoot vcsRoot = vcsManager.getVcsRootObjectFor(filePath);
    AbstractVcs vcs = vcsRoot != null ? vcsRoot.getVcs() : null;
    if (vcsRoot == null || vcs == null) return;

    if (filePath.isDirectory()) {
      filesAndDirs.dirs.add(vcsRoot, filePath);
    }
    else {
      filesAndDirs.files.add(vcsRoot, filePath);
    }

    if (withParentDirectory && vcs.areDirectoriesVersionedItems()) {
      FilePath parentPath = filePath.getParentPath();
      if (parentPath != null && vcsManager.getVcsFor(parentPath) == vcs) {
        filesAndDirs.files.add(vcsRoot, parentPath);
      }
    }
  }
private static void add(@NotNull ProjectLevelVcsManager vcsManager,
                          @NotNull FilesAndDirs filesAndDirs,
                          @NotNull FilePath filePath,
                          boolean withParentDirectory)