Search in sources :

Example 26 with JazzScmCommand

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

the class JazzTagCommand method createTagCreateSnapshotCommand.

// Create the JazzScmCommand to execute the "scm create snapshot ..." command
// This will create a snapshot of the remote repository
public JazzScmCommand createTagCreateSnapshotCommand(JazzScmProviderRepository repo, ScmFileSet fileSet, String tag, ScmTagParameters scmTagParameters) {
    JazzScmCommand command = new JazzScmCommand(JazzConstants.CMD_CREATE, JazzConstants.CMD_SUB_SNAPSHOT, repo, fileSet, getLogger());
    if (tag != null && !tag.trim().equals("")) {
        command.addArgument(JazzConstants.ARG_SNAPSHOT_NAME);
        command.addArgument(tag);
    }
    String message = scmTagParameters.getMessage();
    if (message != null && !message.trim().equals("")) {
        command.addArgument(JazzConstants.ARG_SNAPSHOT_DESCRIPTION);
        command.addArgument(message);
    }
    command.addArgument(repo.getRepositoryWorkspace());
    return command;
}
Also used : JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand)

Example 27 with JazzScmCommand

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

the class JazzTagCommand method createTagCreateWorkspaceCommand.

// Create the JazzScmCommand to execute the "scm create workspace ..." command
// This will create a workspace of the same name as the tag.
public JazzScmCommand createTagCreateWorkspaceCommand(JazzScmProviderRepository repo, ScmFileSet fileSet, String tag) {
    JazzScmCommand command = new JazzScmCommand(JazzConstants.CMD_CREATE, JazzConstants.CMD_SUB_WORKSPACE, repo, fileSet, getLogger());
    if (tag != null && !tag.trim().equals("")) {
        command.addArgument(tag);
        command.addArgument(JazzConstants.ARG_WORKSPACE_SNAPSHOT);
        command.addArgument(tag);
    }
    return command;
}
Also used : JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand)

Example 28 with JazzScmCommand

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

the class JazzUnEditCommand method executeUnEditCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeUnEditCommand(ScmProviderRepository repo, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing unedit command...");
    }
    DebugLoggerConsumer uneditConsumer = new DebugLoggerConsumer(getLogger());
    ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
    JazzScmCommand uneditCmd = createUneditCommand(repo, fileSet);
    int status = uneditCmd.execute(uneditConsumer, errConsumer);
    if (status != 0) {
        return new UnEditScmResult(uneditCmd.getCommandString(), "Error code for Jazz SCM unedit command - " + status, errConsumer.getOutput(), false);
    }
    return new UnEditScmResult(uneditCmd.getCommandString(), "Successfully Completed.", uneditConsumer.getOutput(), true);
}
Also used : ErrorConsumer(org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer) UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand) DebugLoggerConsumer(org.apache.maven.scm.provider.jazz.command.consumer.DebugLoggerConsumer)

Example 29 with JazzScmCommand

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

the class JazzAddCommand method createAddCommand.

public JazzScmCommand createAddCommand(ScmProviderRepository repo, ScmFileSet fileSet) {
    JazzScmCommand command = new JazzScmCommand(JazzConstants.CMD_CHECKIN, null, repo, false, fileSet, getLogger());
    List<File> files = fileSet.getFileList();
    if (files != null && !files.isEmpty()) {
        for (File file : files) {
            // Check in only the files specified
            command.addArgument(file.getPath());
        }
    } else {
        // This will check in all local changes
        command.addArgument(".");
    }
    return command;
}
Also used : JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File)

Example 30 with JazzScmCommand

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

the class JazzBlameCommand method executeBlameCommand.

/**
 * {@inheritDoc}
 */
public BlameScmResult executeBlameCommand(ScmProviderRepository repo, ScmFileSet fileSet, String filename) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("Executing blame command...");
    }
    JazzScmCommand blameCmd = createBlameCommand(repo, fileSet, filename);
    JazzBlameConsumer blameConsumer = new JazzBlameConsumer(repo, getLogger());
    ErrorConsumer errConsumer = new ErrorConsumer(getLogger());
    int status = blameCmd.execute(blameConsumer, errConsumer);
    if (status != 0) {
        return new BlameScmResult(blameCmd.getCommandString(), "Error code for Jazz SCM blame command - " + status, errConsumer.getOutput(), false);
    }
    return new BlameScmResult(blameCmd.getCommandString(), blameConsumer.getLines());
}
Also used : ErrorConsumer(org.apache.maven.scm.provider.jazz.command.consumer.ErrorConsumer) BlameScmResult(org.apache.maven.scm.command.blame.BlameScmResult) JazzScmCommand(org.apache.maven.scm.provider.jazz.command.JazzScmCommand)

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