<commit_before>package com.intellij.cvsSupport2.config;

import com.intellij.CvsBundle;
import com.intellij.cvsSupport2.CvsResultEx;
import com.intellij.cvsSupport2.connections.*;
import com.intellij.cvsSupport2.cvsExecution.ModalityContext;
import com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl;
import com.intellij.cvsSupport2.cvsoperations.common.CvsExecutionEnvironment;
import com.intellij.cvsSupport2.cvsoperations.common.PostCvsActivity;
import com.intellij.cvsSupport2.cvsoperations.cvsContent.GetModulesListOperation;
import com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorMessagesProcessor;
import com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsListenerWithProgress;
import com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDate;
import com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDateImpl;
import com.intellij.cvsSupport2.errorHandling.CvsException;
import com.intellij.cvsSupport2.javacvsImpl.io.ReadWriteStatistics;
import com.intellij.openapi.cvsIntegration.CvsRepository;
import com.intellij.openapi.cvsIntegration.CvsResult;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vcs.VcsException;
import org.netbeans.lib.cvsclient.CvsRoot;
import org.netbeans.lib.cvsclient.ValidRequestsExpectedException;
import org.netbeans.lib.cvsclient.command.CommandException;
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
import org.netbeans.lib.cvsclient.connection.IConnection;
import org.netbeans.lib.cvsclient.util.BugLog;

import java.io.IOException;
import java.util.List;

public class CvsRootConfiguration extends AbstractConfiguration implements CvsEnvironment, Cloneable {
  private static final Logger LOG = Logger.getInstance("#com.intellij.cvsSupport2.config.CvsRootConfiguration");

  public String CVS_ROOT = "";
  public String PATH_TO_WORKING_FOLDER = "";

  public ProxySettings PROXY_SETTINGS = new ProxySettings();
  public ExtConfiguration EXT_CONFIGURATION = new ExtConfiguration();
  public SshSettings SSH_CONFIGURATION = new SshSettings();
  public SshSettings SSH_FOR_EXT_CONFIGURATION = new SshSettings();
  public LocalSettings LOCAL_CONFIGURATION = new LocalSettings();

  public DateOrRevisionSettings DATE_OR_REVISION_SETTINGS = new DateOrRevisionSettings();

  private static final String SEPARATOR = ":";
  private static final String AT = "@";


  public CvsRootConfiguration() {
    super("CvsRootConfiguration");
  }

  private CvsConnectionSettings getSettings() {
    return createSettings();
  }

  public CvsConnectionSettings createSettings() {
    return new IDEARootFormatter(this).createConfiguration();
  }


  public IConnection createConnection(ReadWriteStatistics statistics) {
    return getSettings().createConnection(statistics);
  }

  public String getCvsRootAsString() {
    return CVS_ROOT;
  }

  private static String createFieldByFieldCvsRoot(CvsRepository cvsRepository) {

    return createStringRepresentationOn(CvsMethod.getValue(cvsRepository.getMethod()), cvsRepository.getUser(), cvsRepository.getHost(),
                                        String.valueOf(cvsRepository.getPort()), cvsRepository.getRepository());

  }

  public static String createStringRepresentationOn(CvsMethod method, String user, String host, String port, String repository) {
    StringBuffer result = new StringBuffer();

    if (method == CvsMethod.LOCAL_METHOD) return repository;

    result.append(SEPARATOR);
    result.append(method.getName());
    result.append(SEPARATOR);
    result.append(user);
    result.append(AT);
    result.append(host);
    if (port.length() > 0) {
      result.append(SEPARATOR);
      result.append(port);
    }
    result.append(SEPARATOR);
    result.append(repository);
    return result.toString();
  }

  public String toString() {
    if (useBranch()) {
      return CvsBundle
        .message("cvs.root.configuration.on.branch.string.representation", getCvsRootAsString(), DATE_OR_REVISION_SETTINGS.BRANCH);
    }
    else if (useDate()) {
      return CvsBundle
        .message("cvs.root.configuration.on.date.string.representation", getCvsRootAsString(), DATE_OR_REVISION_SETTINGS.getDate());
    }
    else {
      return getCvsRootAsString();
    }
  }

  private boolean useDate() {<commit_msg>don't include extra colon in CVS root (IDEADEV-9238)<commit_after>package com.intellij.cvsSupport2.config;

import com.intellij.CvsBundle;
import com.intellij.cvsSupport2.CvsResultEx;
import com.intellij.cvsSupport2.connections.*;
import com.intellij.cvsSupport2.cvsExecution.ModalityContext;
import com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl;
import com.intellij.cvsSupport2.cvsoperations.common.CvsExecutionEnvironment;
import com.intellij.cvsSupport2.cvsoperations.common.PostCvsActivity;
import com.intellij.cvsSupport2.cvsoperations.cvsContent.GetModulesListOperation;
import com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorMessagesProcessor;
import com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsListenerWithProgress;
import com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDate;
import com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDateImpl;
import com.intellij.cvsSupport2.errorHandling.CvsException;
import com.intellij.cvsSupport2.javacvsImpl.io.ReadWriteStatistics;
import com.intellij.openapi.cvsIntegration.CvsRepository;
import com.intellij.openapi.cvsIntegration.CvsResult;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vcs.VcsException;
import org.netbeans.lib.cvsclient.CvsRoot;
import org.netbeans.lib.cvsclient.ValidRequestsExpectedException;
import org.netbeans.lib.cvsclient.command.CommandException;
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
import org.netbeans.lib.cvsclient.connection.IConnection;
import org.netbeans.lib.cvsclient.util.BugLog;

import java.io.IOException;
import java.util.List;

public class CvsRootConfiguration extends AbstractConfiguration implements CvsEnvironment, Cloneable {
  private static final Logger LOG = Logger.getInstance("#com.intellij.cvsSupport2.config.CvsRootConfiguration");

  public String CVS_ROOT = "";
  public String PATH_TO_WORKING_FOLDER = "";

  public ProxySettings PROXY_SETTINGS = new ProxySettings();
  public ExtConfiguration EXT_CONFIGURATION = new ExtConfiguration();
  public SshSettings SSH_CONFIGURATION = new SshSettings();
  public SshSettings SSH_FOR_EXT_CONFIGURATION = new SshSettings();
  public LocalSettings LOCAL_CONFIGURATION = new LocalSettings();

  public DateOrRevisionSettings DATE_OR_REVISION_SETTINGS = new DateOrRevisionSettings();

  private static final String SEPARATOR = ":";
  private static final String AT = "@";


  public CvsRootConfiguration() {
    super("CvsRootConfiguration");
  }

  private CvsConnectionSettings getSettings() {
    return createSettings();
  }

  public CvsConnectionSettings createSettings() {
    return new IDEARootFormatter(this).createConfiguration();
  }


  public IConnection createConnection(ReadWriteStatistics statistics) {
    return getSettings().createConnection(statistics);
  }

  public String getCvsRootAsString() {
    return CVS_ROOT;
  }

  private static String createFieldByFieldCvsRoot(CvsRepository cvsRepository) {

    return createStringRepresentationOn(CvsMethod.getValue(cvsRepository.getMethod()), cvsRepository.getUser(), cvsRepository.getHost(),
                                        String.valueOf(cvsRepository.getPort()), cvsRepository.getRepository());

  }

  public static String createStringRepresentationOn(CvsMethod method, String user, String host, String port, String repository) {
    StringBuffer result = new StringBuffer();

    if (method == CvsMethod.LOCAL_METHOD) return repository;

    result.append(SEPARATOR);
    result.append(method.getName());
    result.append(SEPARATOR);
    result.append(user);
    result.append(AT);
    result.append(host);
    if (port.length() > 0) {
      result.append(SEPARATOR);
      result.append(port);
    }
    else {
      result.append(SEPARATOR);
    }
    result.append(repository);
    return result.toString();
  }

  public String toString() {
    if (useBranch()) {
      return CvsBundle
        .message("cvs.root.configuration.on.branch.string.representation", getCvsRootAsString(), DATE_OR_REVISION_SETTINGS.BRANCH);
    }
    else if (useDate()) {
      return CvsBundle
        .message("cvs.root.configuration.on.date.string.representation", getCvsRootAsString(), DATE_OR_REVISION_SETTINGS.getDate());
    }
    else {
      return getCvsRootAsString();
    }
  }

  private boolean useDate() {
{'fraction_non_alphanumeric': 0.09429335711101204, 'fraction_numerical': 0.004012483281319661, 'mean_word_length': 5.381934566145093, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5454444', 'n_tokens_mistral': 2729, 'n_tokens_neox': 2670, 'n_words': 442}