public void addVersion()

in clearcase-server/src/jetbrains/buildServer/buildTriggers/vcs/clearcase/versionTree/VersionTree.java [36:91]


  public void addVersion(String version) throws VcsException {
    
    if (version.contains("CHECKEDOUT view ")) return;
    
    List<String> branches = new ArrayList<String>();
    int intVersion = -1;

    final List<String> versions = StringUtil.split(version, false, File.separatorChar);

    if (versions.size() == 0) return;

    String lastVers = versions.get(versions.size() - 1);

    if (lastVers.startsWith("CHECKEDOUT view ")) {
      return;
    }


    for (int i = 0; i < versions.size() - 1; i++) {
      String s = versions.get(i);
      branches.add(s);
    }

    final List<String> comments = new ArrayList<String>();

    if (lastVers.contains("(")) {

      final int commentBegin = lastVers.indexOf('(');
      final int commentEnd = lastVers.indexOf(')');
      if (commentEnd >= 0) {
        String[] strings = lastVers.substring(commentBegin + 1, commentEnd).split(",");
        for (String comment : strings) {
          if (comment.length() > 0) {
            comments.add(comment.trim());
          }
        }
      }
      lastVers = lastVers.substring(0, commentBegin).trim();
    }

    try {
      intVersion = Integer.parseInt(lastVers);
    } catch (NumberFormatException e) {
      branches.add(lastVers);
    }

    Branch currentBranch = null;
    for (String branch : branches) {
      currentBranch = addBranchToLevel(currentBranch, branch);
    }

    if (currentBranch != null && intVersion != -1) {
      currentBranch.addVersion(intVersion, comments);
    }

  }