Search in sources :

Example 6 with StarteamScmProviderRepository

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

the class StarteamDiffCommand method executeDiffCommand.

// ----------------------------------------------------------------------
// AbstractDiffCommand Implementation
// ----------------------------------------------------------------------
/**
 * {@inheritDoc}
 */
protected DiffScmResult executeDiffCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion) throws ScmException {
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
    }
    if (fileSet.getFileList().isEmpty()) {
        throw new ScmException("This provider doesn't support diff command on a subsets of a directory");
    }
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
    StarteamDiffConsumer consumer = new StarteamDiffConsumer(getLogger(), fileSet.getBasedir());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    Commandline cl = createCommandLine(repository, fileSet, startVersion, endVersion);
    int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
    if (exitCode != 0) {
        return new DiffScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
    }
    return new DiffScmResult(cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(), consumer.getPatch());
}
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) DiffScmResult(org.apache.maven.scm.command.diff.DiffScmResult)

Example 7 with StarteamScmProviderRepository

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

the class StarteamEditCommand method executeEditCommand.

// ----------------------------------------------------------------------
// AbstractEditCommand Implementation
// ----------------------------------------------------------------------
/**
 * {@inheritDoc}
 */
protected ScmResult executeEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
    }
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
    StarteamEditConsumer consumer = new StarteamEditConsumer(getLogger(), fileSet.getBasedir());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    List<File> editFiles = fileSet.getFileList();
    if (editFiles.size() == 0) {
        Commandline cl = createCommandLine(repository, fileSet);
        int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
        if (exitCode != 0) {
            return new EditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
        }
    } else {
        // edit only interested files already on the local disk
        for (int i = 0; i < editFiles.size(); ++i) {
            ScmFileSet editFile = new ScmFileSet(fileSet.getBasedir(), (File) editFiles.get(i));
            Commandline cl = createCommandLine(repository, editFile);
            int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
            if (exitCode != 0) {
                return new EditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
            }
        }
    }
    return new EditScmResult(null, consumer.getEditedFiles());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) 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) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult) File(java.io.File)

Example 8 with StarteamScmProviderRepository

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

the class StarteamUnEditCommand method executeUnEditCommand.

// ----------------------------------------------------------------------
// AbstractEditCommand Implementation
// ----------------------------------------------------------------------
/**
 * {@inheritDoc}
 */
protected ScmResult executeUnEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Working directory: " + fileSet.getBasedir().getAbsolutePath());
    }
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo;
    StarteamUnEditConsumer consumer = new StarteamUnEditConsumer(getLogger(), fileSet.getBasedir());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    List<File> unlockFiles = fileSet.getFileList();
    if (unlockFiles.size() == 0) {
        Commandline cl = createCommandLine(repository, fileSet);
        int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
        if (exitCode != 0) {
            return new UnEditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
        }
    } else {
        // edit only interested files already on the local disk
        for (int i = 0; i < unlockFiles.size(); ++i) {
            ScmFileSet unlockFile = new ScmFileSet(fileSet.getBasedir(), (File) unlockFiles.get(i));
            Commandline cl = createCommandLine(repository, unlockFile);
            int exitCode = StarteamCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
            if (exitCode != 0) {
                return new UnEditScmResult(cl.toString(), "The starteam command failed.", stderr.getOutput(), false);
            }
        }
    }
    return new UnEditScmResult(null, consumer.getUnEditFiles());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) 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) UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) File(java.io.File)

Example 9 with StarteamScmProviderRepository

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

the class StarteamAddCommandTest method testCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet fileSet, String crPath, String commandLine) throws Exception {
    ScmRepository repo = getScmManager().makeScmRepository(scmUrl);
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
    Commandline cl = StarteamAddCommand.createCommandLine(repository, fileSet, crPath);
    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 10 with StarteamScmProviderRepository

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

the class StarteamCheckInCommandTest method testCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
private void testCommandLine(String scmUrl, ScmFileSet fileSet, String message, ScmVersion version, String issueType, String issueValue, String commandLine) throws Exception {
    ScmRepository repo = getScmManager().makeScmRepository(scmUrl);
    StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo.getProviderRepository();
    Commandline cl = StarteamCheckInCommand.createCommandLine(repository, fileSet, message, version, issueType, issueValue);
    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)

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