public static void processChangedFiles()

in clearcase-server/src/jetbrains/buildServer/buildTriggers/vcs/clearcase/CCParseUtil.java [59:108]


  public static void processChangedFiles(final ClearCaseConnection connection,
                                         @NotNull final Revision fromVersion,
                                         @Nullable final Revision toVersion,
                                         @Nullable final ChangedFilesProcessor fileProcessor) throws IOException, VcsException {
    LOG.debug(String.format("Processing changes: fromVersion = [%s], toVersion = [%s]", fromVersion, toVersion));

    final int pastMinutes = getLookForTheChangesInThePastMinutes();
    if (pastMinutes == 0) {
      LOG.debug("Look for the changes in the past: false");
    }
    else {
      LOG.debug(String.format("Look for the changes in the past: true, %d minute(s)", pastMinutes));
    }

    final HistoryElementIterator iterator = getChangesIterator(connection, fromVersion.shiftToPast(pastMinutes));

    final ChangesInverter actualChangesProcessor = fileProcessor == null ? null : new ChangesInverter(fileProcessor),
                          ignoringChangesProcessor = toVersion == null ? null : new ChangesInverter(connection.createIgnoringChangesProcessor());

    try {
      while (iterator.hasNext()) {
        final HistoryElement element = iterator.next();
        final Revision version = Revision.fromChange(element.getChangeInfo());
        if (version.beforeOrEquals(fromVersion)) continue;
        LOG.debug("Processing event: " + element.getLogRepresentation());
        if (CCPathElement.isInsideView(element.getObjectName(), connection.getViewWholePath())) {
          if (toVersion == null || version.beforeOrEquals(toVersion)) {
            if (actualChangesProcessor != null) {
              LOG.debug("Actual change");
              processHistoryElement(element, connection, actualChangesProcessor);
            }
          }
          else {
            LOG.debug("Change to ignore");
            processHistoryElement(element, connection, ignoringChangesProcessor);
          }
        }
      }
    }
    finally {
      iterator.close();
    }

    if (ignoringChangesProcessor != null) {
      ignoringChangesProcessor.processCollectedChangesInInvertedOrder();
    }
    if (actualChangesProcessor != null) {
      actualChangesProcessor.processCollectedChangesInInvertedOrder();
    }
  }