Search in sources :

Example 76 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class ClearCaseCheckOutCommandTest method testUpdateConfigSpec.

public void testUpdateConfigSpec() throws Exception {
    settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_DEFAULT);
    File configSpecLocation;
    if (Os.isFamily("windows")) {
        configSpecLocation = new File("\\\\myserver\\configspecs\\testconfigspec.txt");
    } else {
        configSpecLocation = new File("/clearcase/configspecs/testconfigspec.txt");
    }
    Commandline commandLine = checkOutCommand.createUpdateConfigSpecCommandLine(getWorkingDirectory(), configSpecLocation, "testView");
    assertCommandLine("cleartool setcs -tag testView " + configSpecLocation, getWorkingDirectory(), commandLine);
    settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_LT);
    commandLine = checkOutCommand.createUpdateConfigSpecCommandLine(getWorkingDirectory(), configSpecLocation, "testView");
    assertCommandLine("cleartool setcs -tag testView " + configSpecLocation, getWorkingDirectory(), commandLine);
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File)

Example 77 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class ClearCaseCheckOutCommandTest method testCreateViewCommandLine.

public void testCreateViewCommandLine() throws IOException {
    String viewName = "testView";
    settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_DEFAULT);
    Commandline commandLine = checkOutCommand.createCreateViewCommandLine(getWorkingDirectory(), viewName, null);
    assertCommandLine("cleartool mkview -snapshot -tag testView -vws " + checkOutCommand.getViewStore() + "testView.vws " + getWorkingDirectory().getCanonicalPath(), getWorkingDirectory().getParentFile(), commandLine);
    settings.setUseVWSParameter(false);
    commandLine = checkOutCommand.createCreateViewCommandLine(getWorkingDirectory(), viewName, null);
    assertCommandLine("cleartool mkview -snapshot -tag testView " + getWorkingDirectory().getCanonicalPath(), getWorkingDirectory().getParentFile(), commandLine);
    settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_LT);
    settings.setUseVWSParameter(true);
    commandLine = checkOutCommand.createCreateViewCommandLine(getWorkingDirectory(), viewName, null);
    assertCommandLine("cleartool mkview -snapshot -tag testView " + getWorkingDirectory().getCanonicalPath(), getWorkingDirectory().getParentFile(), commandLine);
    settings.setUseVWSParameter(false);
    commandLine = checkOutCommand.createCreateViewCommandLine(getWorkingDirectory(), viewName, null);
    assertCommandLine("cleartool mkview -snapshot -tag testView " + getWorkingDirectory().getCanonicalPath(), getWorkingDirectory().getParentFile(), commandLine);
    settings.setClearcaseType(ClearCaseScmProviderRepository.CLEARCASE_UCM);
    String streamId = "streamIdentifier";
    commandLine = checkOutCommand.createCreateViewCommandLine(getWorkingDirectory(), viewName, streamId);
    assertCommandLine("cleartool mkview -snapshot -tag testView -stream " + streamId + " " + getWorkingDirectory().getCanonicalPath(), getWorkingDirectory().getParentFile(), commandLine);
    settings.setUseVWSParameter(true);
    commandLine = checkOutCommand.createCreateViewCommandLine(getWorkingDirectory(), viewName, streamId);
    assertCommandLine("cleartool mkview -snapshot -tag testView -stream " + streamId + " -vws " + checkOutCommand.getViewStore() + "testView.vws " + getWorkingDirectory().getCanonicalPath(), getWorkingDirectory().getParentFile(), commandLine);
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline)

Example 78 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class AbstractCvsStatusCommand method executeStatusCommand.

/**
 * {@inheritDoc}
 */
protected StatusScmResult executeStatusCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
    CvsScmProviderRepository repository = (CvsScmProviderRepository) repo;
    Commandline cl = CvsCommandUtils.getBaseCommand("update", repository, fileSet, "-n");
    cl.createArg().setValue("-d");
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Executing: " + cl);
        getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
    }
    return executeCvsCommand(cl);
}
Also used : CvsScmProviderRepository(org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository) Commandline(org.codehaus.plexus.util.cli.Commandline)

Example 79 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class AbstractCvsTagCommand method executeTagCommand.

/**
 * {@inheritDoc}
 */
public ScmResult executeTagCommand(ScmProviderRepository repo, ScmFileSet fileSet, String tag, ScmTagParameters scmTagParameters) throws ScmException {
    CvsScmProviderRepository repository = (CvsScmProviderRepository) repo;
    Commandline cl = CvsCommandUtils.getBaseCommand("tag", repository, fileSet, false);
    Settings settings = CvsUtil.getSettings();
    if (settings.isUseForceTag()) {
        cl.createArg().setValue("-F");
    }
    cl.createArg().setValue("-c");
    cl.createArg().setValue(tag);
    if (fileSet.getFileList() != null && !fileSet.getFileList().isEmpty()) {
        for (Iterator<File> it = fileSet.getFileList().iterator(); it.hasNext(); ) {
            File fileName = it.next();
            cl.createArg().setValue(fileName.toString());
        }
    }
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Executing: " + cl);
        getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
    }
    return executeCvsCommand(cl);
}
Also used : CvsScmProviderRepository(org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository) Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File) Settings(org.apache.maven.scm.providers.cvslib.settings.Settings)

Example 80 with Commandline

use of org.codehaus.plexus.util.cli.Commandline in project maven-scm by apache.

the class AbstractCvsUpdateCommand method executeUpdateCommand.

/**
 * {@inheritDoc}
 */
public UpdateScmResult executeUpdateCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version) throws ScmException {
    CvsScmProviderRepository repository = (CvsScmProviderRepository) repo;
    Commandline cl = CvsCommandUtils.getBaseCommand("update", repository, fileSet, false);
    cl.createArg().setValue("-d");
    if (version != null && StringUtils.isNotEmpty(version.getName())) {
        cl.createArg().setValue("-r" + version.getName());
    }
    List<File> files = fileSet.getFileList();
    if (!files.isEmpty()) {
        Iterator<File> fileIterator = files.iterator();
        while (fileIterator.hasNext()) {
            cl.createArg().setValue(((File) fileIterator.next()).getPath());
        }
    }
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Executing: " + cl);
        getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
    }
    return executeCvsCommand(cl);
}
Also used : CvsScmProviderRepository(org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository) Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File)

Aggregations

Commandline (org.codehaus.plexus.util.cli.Commandline)446 File (java.io.File)133 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)117 ScmException (org.apache.maven.scm.ScmException)84 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)70 ScmRepository (org.apache.maven.scm.repository.ScmRepository)51 IOException (java.io.IOException)48 ScmFileSet (org.apache.maven.scm.ScmFileSet)34 Test (org.junit.Test)28 StringStreamConsumer (org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer)26 ArrayList (java.util.ArrayList)22 StarteamScmProviderRepository (org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository)22 PerforceScmProviderRepository (org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository)19 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)18 SvnCommandLineUtils (org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils)17 GitCommandLineUtils (org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils)16 GitScmProviderRepository (org.apache.maven.scm.provider.git.repository.GitScmProviderRepository)16 SvnScmProviderRepository (org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository)16 ScmFile (org.apache.maven.scm.ScmFile)13 CvsScmProviderRepository (org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository)13