protected ChangeParser()

in clearcase-common/src/jetbrains/buildServer/vcs/clearcase/CTool.java [565:606]


    protected ChangeParser(String line) {
      int tokenLength = 0;
      // detect change kind
      if (line.startsWith(UPDATED_TOKEN)) {
        tokenLength = UPDATED_TOKEN.length();
        isChange = true;
      } else if (line.startsWith(NEW_TOKEN)) {
        tokenLength = NEW_TOKEN.length();
        isAddition = true;
      } else if (line.startsWith(UNLOADED_DELETED_TOKEN)) {
        tokenLength = UNLOADED_DELETED_TOKEN.length();
        isDeletion = true;
      }
      // extract token
      line = line.substring(tokenLength).trim();
      // get local path
      int versionBeforStartIdx = 0;
      if (line.startsWith("\"")) {
        versionBeforStartIdx = line.indexOf("\"", 1);
        myLocalPath = line.substring(1, versionBeforStartIdx);
      } else {
        versionBeforStartIdx = line.indexOf(" ");
        if (versionBeforStartIdx != -1) {
          myLocalPath = line.substring(0, versionBeforStartIdx);
        } else {
          myLocalPath = line.trim();
        }

      }
      // discover version part if exists
      if (versionBeforStartIdx != -1) {
        String versionsPart = line.substring(versionBeforStartIdx + 1).trim();
        final String[] versions = versionsPart.split("[ +]");
        if (versions.length > 0) {
          myVersionAfter = versions[0];
        }
        if (versions.length > 1) {
          myVersionBefor = myVersionAfter;
          myVersionAfter = versions[1];
        }
      }
    }