Search in sources :

Example 21 with UpdateScmResult

use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.

the class BazaarScmProvider method update.

/**
 * {@inheritDoc}
 */
public UpdateScmResult update(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    BazaarUpdateCommand command = new BazaarUpdateCommand();
    command.setLogger(getLogger());
    return (UpdateScmResult) command.execute(repository, fileSet, parameters);
}
Also used : BazaarUpdateCommand(org.apache.maven.scm.provider.bazaar.command.update.BazaarUpdateCommand) UpdateScmResult(org.apache.maven.scm.command.update.UpdateScmResult)

Example 22 with UpdateScmResult

use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.

the class TfsUpdateCommand method executeUpdateCommand.

protected UpdateScmResult executeUpdateCommand(ScmProviderRepository r, ScmFileSet f, ScmVersion v) throws ScmException {
    FileListConsumer fileConsumer = new FileListConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    TfsCommand command = createCommand(r, f, v);
    int status = command.execute(fileConsumer, err);
    if (status != 0 || err.hasBeenFed()) {
        return new UpdateScmResult(command.getCommandString(), "Error code for TFS update command - " + status, err.getOutput(), false);
    }
    return new UpdateScmResult(command.getCommandString(), fileConsumer.getFiles());
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) UpdateScmResult(org.apache.maven.scm.command.update.UpdateScmResult) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Example 23 with UpdateScmResult

use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.

the class VssUpdateCommand method executeUpdateCommand.

// TODO handle deleted files from VSS
/**
 * {@inheritDoc}
 */
protected UpdateScmResult executeUpdateCommand(ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("executing update command...");
    }
    VssScmProviderRepository repo = (VssScmProviderRepository) repository;
    Commandline cl = buildCmdLine(repo, fileSet, version);
    VssUpdateConsumer consumer = new VssUpdateConsumer(repo, getLogger());
    // TODO handle deleted files from VSS
    // TODO identify local files
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    int exitCode;
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
    }
    exitCode = VssCommandLineUtils.executeCommandline(cl, consumer, stderr, getLogger());
    if (exitCode != 0) {
        String error = stderr.getOutput();
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("VSS returns error: [" + error + "] return code: [" + exitCode + "]");
        }
        if (error.indexOf("A writable copy of") < 0) {
            return new UpdateScmResult(cl.toString(), "The vss command failed.", error, false);
        }
        // print out the writable copy for manual handling
        if (getLogger().isWarnEnabled()) {
            getLogger().warn(error);
        }
    }
    return new UpdateScmResult(cl.toString(), consumer.getUpdatedFiles());
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) VssScmProviderRepository(org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository) VssCommandLineUtils(org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) UpdateScmResult(org.apache.maven.scm.command.update.UpdateScmResult)

Example 24 with UpdateScmResult

use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.

the class HgScmProvider method update.

/**
 * {@inheritDoc}
 */
public UpdateScmResult update(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    HgUpdateCommand command = new HgUpdateCommand();
    command.setLogger(getLogger());
    return (UpdateScmResult) command.execute(repository, fileSet, parameters);
}
Also used : UpdateScmResult(org.apache.maven.scm.command.update.UpdateScmResult) HgUpdateCommand(org.apache.maven.scm.provider.hg.command.update.HgUpdateCommand)

Example 25 with UpdateScmResult

use of org.apache.maven.scm.command.update.UpdateScmResult in project maven-scm by apache.

the class ClearCaseUpdateCommand method executeUpdateCommand.

/**
 * {@inheritDoc}
 */
protected UpdateScmResult executeUpdateCommand(ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("executing update command...");
    }
    Commandline cl = createCommandLine(fileSet);
    ClearCaseUpdateConsumer consumer = new ClearCaseUpdateConsumer(getLogger());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    int exitCode;
    try {
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString());
        }
        exitCode = CommandLineUtils.executeCommandLine(cl, consumer, stderr);
    } catch (CommandLineException ex) {
        throw new ScmException("Error while executing clearcase command.", ex);
    }
    if (exitCode != 0) {
        return new UpdateScmResult(cl.toString(), "The cleartool command failed.", stderr.getOutput(), false);
    }
    return new UpdateScmResult(cl.toString(), consumer.getUpdatedFiles());
}
Also used : ScmException(org.apache.maven.scm.ScmException) Commandline(org.codehaus.plexus.util.cli.Commandline) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) UpdateScmResult(org.apache.maven.scm.command.update.UpdateScmResult) CommandLineException(org.codehaus.plexus.util.cli.CommandLineException)

Aggregations

UpdateScmResult (org.apache.maven.scm.command.update.UpdateScmResult)35 File (java.io.File)10 ScmFile (org.apache.maven.scm.ScmFile)10 ScmException (org.apache.maven.scm.ScmException)9 UpdateScmResultWithRevision (org.apache.maven.scm.command.update.UpdateScmResultWithRevision)7 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)7 ScmFileSet (org.apache.maven.scm.ScmFileSet)6 ArrayList (java.util.ArrayList)5 ScmRepository (org.apache.maven.scm.repository.ScmRepository)5 Commandline (org.codehaus.plexus.util.cli.Commandline)5 Date (java.util.Date)4 ChangeSet (org.apache.maven.scm.ChangeSet)4 CommandParameters (org.apache.maven.scm.CommandParameters)4 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)4 IOException (java.io.IOException)3 ScmFileMatcher.assertHasScmFile (org.apache.maven.scm.ScmFileMatcher.assertHasScmFile)3 ScmManager (org.apache.maven.scm.manager.ScmManager)3 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 ScmResult (org.apache.maven.scm.ScmResult)2