Search in sources :

Example 1 with SvnDiffConsumer

use of org.apache.maven.scm.provider.svn.command.diff.SvnDiffConsumer in project maven-scm by apache.

the class SvnDiffCommand method executeDiffCommand.

/**
 * {@inheritDoc}
 */
protected DiffScmResult executeDiffCommand(ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion) throws ScmException {
    Commandline cl = createCommandLine((SvnScmProviderRepository) repo, fileSet.getBasedir(), startVersion, endVersion);
    SvnDiffConsumer consumer = new SvnDiffConsumer(getLogger(), fileSet.getBasedir());
    CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Executing: " + SvnCommandLineUtils.cryptPassword(cl));
        if (Os.isFamily(Os.FAMILY_WINDOWS)) {
            getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
        }
    }
    int exitCode;
    try {
        exitCode = SvnCommandLineUtils.execute(cl, consumer, stderr, getLogger());
    } catch (CommandLineException ex) {
        throw new ScmException("Error while executing command.", ex);
    }
    if (exitCode != 0) {
        return new DiffScmResult(cl.toString(), "The svn 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) SvnDiffConsumer(org.apache.maven.scm.provider.svn.command.diff.SvnDiffConsumer) CommandLineUtils(org.codehaus.plexus.util.cli.CommandLineUtils) SvnCommandLineUtils(org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils) CommandLineException(org.codehaus.plexus.util.cli.CommandLineException) DiffScmResult(org.apache.maven.scm.command.diff.DiffScmResult)

Aggregations

ScmException (org.apache.maven.scm.ScmException)1 DiffScmResult (org.apache.maven.scm.command.diff.DiffScmResult)1 SvnDiffConsumer (org.apache.maven.scm.provider.svn.command.diff.SvnDiffConsumer)1 SvnCommandLineUtils (org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils)1 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)1 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)1 Commandline (org.codehaus.plexus.util.cli.Commandline)1