public void getChanges()

in src/org/jetbrains/tfsIntegration/core/TFSChangeProvider.java [51:106]


  public void getChanges(@NotNull final VcsDirtyScope dirtyScope,
                         @NotNull final ChangelistBuilder builder,
                         @NotNull final ProgressIndicator progress,
                         @NotNull final ChangeListManagerGate addGate) throws VcsException {
    if (myProject.isDisposed()) {
      return;
    }
    if (builder == null) {
      return;
    }

    progress.setText("Processing changes");

    // process only roots, filter out child items since requests are recursive anyway
    RootsCollection.FilePathRootsCollection roots = new RootsCollection.FilePathRootsCollection();
    roots.addAll(dirtyScope.getRecursivelyDirtyDirectories());

    final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
    for (FilePath dirtyFile : dirtyScope.getDirtyFiles()) {
      // workaround for IDEADEV-31511 and IDEADEV-31721
      if (dirtyFile.getVirtualFile() == null || !changeListManager.isIgnoredFile(dirtyFile.getVirtualFile())) {
        roots.add(dirtyFile);
      }
    }

    if (roots.isEmpty()) {
      return;
    }

    try {
      final Ref<Boolean> mappingFound = Ref.create(false);
      // ingore orphan roots here
      WorkstationHelper.processByWorkspaces(roots, true, myProject, new WorkstationHelper.VoidProcessDelegate() {
        @Override
        public void executeRequest(final WorkspaceInfo workspace, final List<ItemPath> paths) throws TfsException {
          StatusProvider
            .visitByStatus(workspace, paths, true, progress, new ChangelistBuilderStatusVisitor(myProject, builder, workspace), myProject);
          mappingFound.set(true);
        }
      });
      if (!mappingFound.get()) {
        final String message;
        if (roots.size() > 1) {
          message = "Team Foundation Server mappings not found";
        }
        else {
          FilePath orphan = roots.iterator().next();
          message = MessageFormat.format("Team Foundation Server mappings not found for ''{0}''", orphan.getPresentableUrl());
        }
        throw new VcsException(message);
      }
    }
    catch (TfsException e) {
      throw new VcsException(e.getMessage(), e);
    }
  }