private void processRawChangeInfo()

in vault-server/src/jetbrains/buildServer/buildTriggers/vcs/vault/VaultChangeCollector.java [72:242]


  private void processRawChangeInfo(@NotNull Stack<ChangeInfo> changes, @NotNull RawChangeInfo rawChangeInfo) throws VcsException {

    final String repoPath = VaultUtil.getFullRepoPathWithCommonPart(rawChangeInfo.getPath(), myTargetPath);

    LOG.debug(rawChangeInfo);

    final String misc1 = rawChangeInfo.getAdditionalPath1();
    final String misc2 = rawChangeInfo.getAdditionalPath2();
    final String version = rawChangeInfo.getVersion();

    final ModificationInfo mi = new ModificationInfo(version, getDisplayVersion(version), rawChangeInfo.getUser(), rawChangeInfo.getComment(), rawChangeInfo.getDate());

    final String changeName = rawChangeInfo.getChangeName();
    final RawChangeInfo.RawChangeInfoType type = rawChangeInfo.getType();

    switch (type) {

      case ADDED: {
        final String histPath = myPathHistory.getOldPath(repoPath) + "/" + misc1;
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        final boolean isFile = isFile(currPath, histPath, version);

        pushChange(changes, changeName, mi, histPath, type.getChangeInfoType(isFile));

        myPathHistory.delete(histPath);
        myIsFileCache.remove(currPath);

        break;
      }

      case DELETED: {
        final String histPath = myPathHistory.getOldPath(repoPath) + "/" + misc1;
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        boolean isFile = checkIfFileWasDeleted(histPath, currPath, mi.getPrevVersion());

        pushChange(changes, changeName, mi, histPath, type.getChangeInfoType(isFile));

        break;
      }

      case RENAMED: {
        final String histPath = myPathHistory.getOldPath(repoPath);
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        final boolean isFile = isFile(currPath, histPath, version);

        final String histParentPath = getRepoParentPath(histPath);

        if (isFile) {
          pushChange(changes, changeName, mi, histPath, ADDED);
          pushChange(changes, changeName, mi, histParentPath + "/" + misc2, REMOVED);
        } else {
          addFolderContent(histPath, changes, changeName, mi);
          pushChange(changes, changeName, mi, histParentPath + "/" + misc2, DIRECTORY_REMOVED);
        }

        myPathHistory.rename(histParentPath, misc2, misc1);
        myIsFileCache.remove(currPath);

        break;
      }

      case RENAMED_ITEM: {
        final String histParentPath = myPathHistory.getOldPath(repoPath);

        final String histPath = histParentPath + "/" + misc1;
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;

        if (changes.isEmpty() || !changes.peek().getRepoPath().equals(histParentPath + "/" + misc2) || !(DIRECTORY_REMOVED.equals(changes.peek().getChangeType()))) {
          final boolean isFile = isFile(currPath, histPath, version);
          if (isFile) {
            pushChange(changes, changeName, mi, histPath, ADDED);
            pushChange(changes, changeName, mi, histParentPath + "/" + misc2, REMOVED);
          } else {
            addFolderContent(histPath, changes, changeName, mi);
            pushChange(changes, changeName, mi, histParentPath + "/" + misc2, DIRECTORY_REMOVED);
          }

          myPathHistory.rename(histParentPath, misc2, misc1);
          myIsFileCache.remove(currPath);
        }
        break;
      }

      case MOVED_TO: {
        final String histParentPath = myPathHistory.getOldPath(repoPath);

        final String histPath = misc2;
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        final boolean isFile = isFile(currPath, histPath, version);

        if (isFile) {
          pushChange(changes, changeName, mi, histPath, ADDED);
          pushChange(changes, changeName, mi, histParentPath + "/" + misc1, REMOVED);
        } else {
          addFolderContent(histPath, changes, changeName, mi);
          pushChange(changes, changeName, mi, histParentPath + "/" + misc1, DIRECTORY_REMOVED);
        }

        myPathHistory.move(histParentPath, getRepoParentPath(misc2), misc1);
        myIsFileCache.remove(currPath);

        break;
      }

      case SHARED_TO: {
        final String histPath = misc2;
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        final boolean isFile = isFile(currPath, histPath, version);

        if (isFile) {
          pushChange(changes, changeName, mi, histPath, ADDED);
        } else {
          addFolderContent(histPath, changes, changeName, mi);
        }

        myIsFileCache.remove(currPath);

        break;
      }

      case BRANCHED_FROM_ITEM: {
        final String histPath = myPathHistory.getOldPath(repoPath);
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        final boolean isFile = isFile(currPath, histPath, version);

        pushChange(changes, changeName, mi, histPath, type.getChangeInfoType(isFile));

        myIsFileCache.remove(currPath);
        addBranchedPath(currPath);

        break;
      }

      case CHECK_IN: {
        final String histPath = myPathHistory.getOldPath(repoPath);
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        pushChange(changes, changeName, mi, histPath, CHANGED); // it's always a file
        break;
      }

      case UNDELETED: {
        final String histPath = myPathHistory.getOldPath(repoPath) + "/" + misc1;
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        final boolean isFile = isFile(currPath, histPath, version);

        pushChange(changes, changeName, mi, histPath, type.getChangeInfoType(isFile));

        break;
      }

      default: {
        final String histPath = myPathHistory.getOldPath(repoPath);
        final String currPath = myPathHistory.getNewPath(histPath);
        if (skipBranchedPath(currPath, rawChangeInfo)) return;
        final boolean isFile = isFile(currPath, histPath, version);

        pushChange(changes, changeName, mi, histPath, type.getChangeInfoType(isFile));

        break;
      }
    }
  }