Search in sources :

Example 11 with StarteamScmProviderRepository

use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.

the class StarteamStatusCommand method executeStatusCommand.

// ----------------------------------------------------------------------
// AbstractStatusCommand Implementation
// ----------------------------------------------------------------------
/**
 * {@inheritDoc}
 */
protected StatusScmResult executeStatusCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
    }
    if (fileSet.getFileList().size() != 0) {
        throw new ScmException("This provider doesn't support checking status of a subsets of a directory");
    }
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
    StarteamStatusConsumer consumer = new StarteamStatusConsumer(getLogger(), fileSet.getBasedir());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    Commandline cl = createCommandLine(repository, fileSet);
    int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
    if (exitCode != 0) {
        return new StatusScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
    }
    return new StatusScmResult(cl.toString(), consumer.getChangedFiles());
}
Also used : StatusScmResult(org.apache.maven.scm.command.status.StatusScmResult) ScmException(org.apache.maven.scm.ScmException) Commandline(org.codehaus.plexus.util.cli.Commandline) StarteamScmProviderRepository(org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) StarteamCommandLineUtils(org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils)

Example 12 with StarteamScmProviderRepository

use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.

the class StarteamDiffCommandTest method testCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet basedir, ScmVersion startLabel, ScmVersion endLabel, String commandLine) throws Exception {
    ScmRepository repo = getScmManager().makeScmRepository(scmUrl);
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
    Commandline cl = StarteamDiffCommand.createCommandLine(repository, basedir, startLabel, endLabel);
    assertCommandLine(commandLine, null, cl);
}
Also used : ScmRepository(org.apache.maven.scm.repository.ScmRepository) Commandline(org.codehaus.plexus.util.cli.Commandline) StarteamScmProviderRepository(org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository)

Example 13 with StarteamScmProviderRepository

use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.

the class StarteamStatusCommandTest method testCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet workDir, String commandLine) throws Exception {
    ScmRepository repo = getScmManager().makeScmRepository(scmUrl);
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
    Commandline cl = StarteamStatusCommand.createCommandLine(repository, workDir);
    assertCommandLine(commandLine, null, cl);
}
Also used : ScmRepository(org.apache.maven.scm.repository.ScmRepository) Commandline(org.codehaus.plexus.util.cli.Commandline) StarteamScmProviderRepository(org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository)

Example 14 with StarteamScmProviderRepository

use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.

the class StarteamUpdateCommandTest method testCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet fileSet, ScmVersion version, String commandLine) throws Exception {
    ScmRepository repo = getScmManager().makeScmRepository(scmUrl);
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
    Commandline cl = StarteamUpdateCommand.createCommandLine(repository, fileSet, version);
    System.out.println(commandLine);
    System.out.println(cl);
    assertCommandLine(commandLine, null, cl);
}
Also used : ScmRepository(org.apache.maven.scm.repository.ScmRepository) Commandline(org.codehaus.plexus.util.cli.Commandline) StarteamScmProviderRepository(org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository)

Example 15 with StarteamScmProviderRepository

use of org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository in project maven-scm by apache.

the class StarteamTagCommand method executeTagCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeTagCommand(ScmProviderRepository repo, ScmFileSet fileSet, String tag, ScmTagParameters scmTagParameters) throws ScmException {
    if (fileSet.getFileList().isEmpty()) {
        throw new ScmException("This provider doesn't support tagging subsets of a directory");
    }
    if (tag == null || tag.trim().length() == 0) {
        throw new ScmException("tag must be specified");
    }
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
    }
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
    StarteamTagConsumer consumer = new StarteamTagConsumer(getLogger());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    Commandline cl = createCommandLine(repository, fileSet.getBasedir(), tag);
    int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
    if (exitCode != 0) {
        return new TagScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
    }
    return new TagScmResult(cl.toString(), consumer.getTaggedFiles());
}
Also used : ScmException(org.apache.maven.scm.ScmException) Commandline(org.codehaus.plexus.util.cli.Commandline) StarteamScmProviderRepository(org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository) StarteamCommandLineUtils(org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) TagScmResult(org.apache.maven.scm.command.tag.TagScmResult)

Aggregations

StarteamScmProviderRepository (org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository)24 Commandline (org.codehaus.plexus.util.cli.Commandline)22 StarteamCommandLineUtils (org.apache.maven.scm.provider.starteam.command.StarteamCommandLineUtils)11 ScmRepository (org.apache.maven.scm.repository.ScmRepository)11 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)11 File (java.io.File)6 ScmException (org.apache.maven.scm.ScmException)6 ScmFileSet (org.apache.maven.scm.ScmFileSet)6 IOException (java.io.IOException)1 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)1 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)1 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)1 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)1 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)1 DiffScmResult (org.apache.maven.scm.command.diff.DiffScmResult)1 EditScmResult (org.apache.maven.scm.command.edit.EditScmResult)1 RemoveScmResult (org.apache.maven.scm.command.remove.RemoveScmResult)1 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)1 TagScmResult (org.apache.maven.scm.command.tag.TagScmResult)1 UnEditScmResult (org.apache.maven.scm.command.unedit.UnEditScmResult)1