private boolean refreshIncomingInFile(Collection<FilePath> incomingFiles, List<IncomingChangeListData> list) throws IOException {
      // the incoming changelist pointers are actually sorted in reverse chronological order,
      // so we process file delete changes before changes made to deleted files before they were deleted

      Map<Pair<IncomingChangeListData, Change>, VirtualFile> revisionDependentFiles = new HashMap<>();
      Map<Pair<IncomingChangeListData, Change>, ProcessingResult> results = new HashMap<>();

      myIndexStreamCachedLength = myChangesCacheFile.myIndexStream.length();
      // try to process changelists in a light way, remember which files need revisions
      Stopwatch stopWatch = Stopwatch.createUnstarted();
      for(IncomingChangeListData data: list) {
        stopWatch.reset().start();
        debug("Checking incoming changelist " + data.changeList.getNumber());

        for(Change change: data.getChangesToProcess()) {
          final ProcessingResult result = processIncomingChange(change, data, incomingFiles);

          Pair<IncomingChangeListData, Change> key = Pair.create(data, change);
          results.put(key, result);
          if (result.revisionDependentProcessing != null) {
            revisionDependentFiles.put(key, result.file);
          }
        }
        debug("Finished checking incoming changelist " + data.changeList.getNumber() + " in " + stopWatch.stop());
      }

      if (!revisionDependentFiles.isEmpty()) {
        // lots of same files could be collected - make set of unique files
        HashSet<VirtualFile> uniqueFiles = new HashSet<>(revisionDependentFiles.values());
        // bulk-get all needed revisions at once
        Map<VirtualFile, VcsRevisionNumber> revisions = myDiffProvider instanceof DiffProviderEx
                                                        ? ((DiffProviderEx)myDiffProvider).getCurrentRevisions(uniqueFiles)
                                                        : DiffProviderEx.getCurrentRevisions(uniqueFiles, myDiffProvider);

        // perform processing requiring those revisions
        for(IncomingChangeListData data: list) {
          for (Change change : data.getChangesToProcess()) {
            Pair<IncomingChangeListData, Change> key = Pair.create(data, change);
            Function<VcsRevisionNumber, ProcessingResult> revisionHandler = results.get(key).revisionDependentProcessing;
            if (revisionHandler != null) {
              results.put(key, revisionHandler.fun(revisions.get(revisionDependentFiles.get(key))));
            }
          }
        }
      }

      // collect and save processing results
      for(IncomingChangeListData data: list) {
        boolean updated = false;
        boolean anyChangeFound = false;
        for (Change change : data.getChangesToProcess()) {
          final ContentRevision revision = (change.getAfterRevision() == null) ? change.getBeforeRevision() : change.getAfterRevision();
          assert revision != null;
          ProcessingResult result = results.get(Pair.create(data, change));
          new IncomingChangeState(change, revision.getRevisionNumber().asString(), result.state).logSelf();
          if (result.changeFound) {
            updated = true;
            data.accountedChanges.add(change);
          } else {
            anyChangeFound = true;
          }
        }
        if (updated || ! anyChangeFound) {
          myAnyChanges = true;
          myChangesCacheFile.saveIncoming(data, !anyChangeFound);
        }
      }
      return myAnyChanges || !list.isEmpty();
    }
private boolean refreshIncomingInFile(Collection<FilePath> incomingFiles, List<IncomingChangeListData> list)