Search in sources :

Example 21 with JazzScmCommand

use of org.apache.maven.scm.provider.jazz.command.JazzScmCommand in project maven-scm by apache.

the class JazzEditCommand method createEditCommand.

protected JazzScmCommand createEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) {
    JazzScmCommand command = new JazzScmCommand(JazzConstants.CMD_LOCK, JazzConstants.CMD_SUB_ACQUIRE, repo, fileSet, getLogger());
    List<File> files = fileSet.getFileList();
    if (files != null && !files.isEmpty()) {
        for (File file : files) {
            // Lock only the files specified
            command.addArgument(file.getPath());
        }
    } else {
        // Lock all files
        command.addArgument(".");
    }
    return command;
}
Also used : JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand) File(java.io.File)

Example 22 with JazzScmCommand

use of org.apache.maven.scm.provider.jazz.command.JazzScmCommand in project maven-scm by apache.

the class JazzListCommand method executeListCommand.

/**
 * {@inheritDoc}
 */
protected ListScmResult executeListCommand(ScmProviderRepository repo, ScmFileSet fileSet, boolean recursive, ScmVersion version) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing list command...");
    }
    JazzScmProviderRepository jazzRepo = (JazzScmProviderRepository) repo;
    JazzListConsumer listConsumer = new JazzListConsumer(repo, getLogger());
    ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
    JazzScmCommand listCmd = createListCommand(jazzRepo, fileSet, recursive, version);
    int status = listCmd.execute(listConsumer, errConsumer);
    if (status != 0) {
        return new ListScmResult(listCmd.getCommandString(), "Error code for Jazz SCM list command - " + status, errConsumer.getOutput(), false);
    }
    return new ListScmResult(listCmd.getCommandString(), listConsumer.getFiles());
}
Also used : ErrorConsumer(org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer) ListScmResult(org.apache.maven.scm.command.list.ListScmResult) JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand) JazzScmProviderRepository(org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository)

Example 23 with JazzScmCommand

use of org.apache.maven.scm.provider.jazz.command.JazzScmCommand in project maven-scm by apache.

the class JazzListCommand method createListCommand.

public JazzScmCommand createListCommand(JazzScmProviderRepository repo, ScmFileSet fileSet, boolean recursive, ScmVersion version) {
    // recursive is implicit in the command, so it is ignored. NOTE: V4 appears to have changed this.
    // version is meaningless, so it is ignored.
    JazzScmCommand command = new JazzScmCommand(JazzConstants.CMD_LIST, JazzConstants.CMD_SUB_REMOTEFILES, repo, fileSet, getLogger());
    if (recursive) {
        command.addArgument(JazzConstants.ARG_DEPTH);
        command.addArgument(JazzConstants.ARG_DEPTH_INFINTE);
    }
    command.addArgument(repo.getRepositoryWorkspace());
    command.addArgument(repo.getComponent());
    return command;
}
Also used : JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand)

Example 24 with JazzScmCommand

use of org.apache.maven.scm.provider.jazz.command.JazzScmCommand in project maven-scm by apache.

the class JazzStatusCommand method createStatusCommand.

public JazzScmCommand createStatusCommand(ScmProviderRepository repo, ScmFileSet fileSet) {
    JazzScmCommand command = new JazzScmCommand(JazzConstants.CMD_STATUS, null, repo, false, fileSet, getLogger());
    command.addArgument(JazzConstants.ARG_STATUS_WIDE_PRINT_OUT);
    return command;
}
Also used : JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand)

Example 25 with JazzScmCommand

use of org.apache.maven.scm.provider.jazz.command.JazzScmCommand in project maven-scm by apache.

the class JazzStatusCommand method executeStatusCommand.

/**
 * {@inheritDoc}
 */
public StatusScmResult executeStatusCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing status command...");
    }
    JazzStatusConsumer statusConsumer = new JazzStatusConsumer(repo, getLogger());
    ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
    JazzScmCommand statusCmd = createStatusCommand(repo, fileSet);
    int status = statusCmd.execute(statusConsumer, errConsumer);
    if (status != 0) {
        return new StatusScmResult(statusCmd.getCommandString(), "Error code for Jazz SCM status command - " + status, errConsumer.getOutput(), false);
    }
    if (getLogger().isDebugEnabled()) {
        if (!statusConsumer.getChangedFiles().isEmpty()) {
            getLogger().debug("Iterating over \"Status\" results");
            for (ScmFile file : statusConsumer.getChangedFiles()) {
                getLogger().debug(file.getPath() + " : " + file.getStatus());
            }
        } else {
            getLogger().debug("There are no differences");
        }
    }
    return new StatusScmResult(statusCmd.getCommandString(), statusConsumer.getChangedFiles());
}
Also used : StatusScmResult(org.apache.maven.scm.command.status.StatusScmResult) ErrorConsumer(org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer) JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand) ScmFile(org.apache.maven.scm.ScmFile)

Aggregations

JazzScmCommand (org.apache.maven.scm.provider.jazz.command.JazzScmCommand)31 ErrorConsumer (org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer)13 File (java.io.File)7 JazzScmProviderRepository (org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository)7 ScmFile (org.apache.maven.scm.ScmFile)6 DebugLoggerConsumer (org.apache.maven.scm.provider.jazz.command.consumer.DebugLoggerConsumer)6 ArrayList (java.util.ArrayList)3 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)3 JazzStatusCommand (org.apache.maven.scm.provider.jazz.command.status.JazzStatusCommand)3 ScmException (org.apache.maven.scm.ScmException)2 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)2 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)2 StreamConsumer (org.codehaus.plexus.util.cli.StreamConsumer)2 HashMap (java.util.HashMap)1 ChangeSet (org.apache.maven.scm.ChangeSet)1 ScmBranch (org.apache.maven.scm.ScmBranch)1 ScmTag (org.apache.maven.scm.ScmTag)1 BlameScmResult (org.apache.maven.scm.command.blame.BlameScmResult)1 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)1 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)1