Search in sources :

Example 11 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class JazzEditCommand method executeEditCommand.

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

Example 12 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class JazzScmProvider method edit.

/**
 * {@inheritDoc}
 */
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    getLogger().debug("JazzScmProvider:edit()");
    JazzEditCommand command = new JazzEditCommand();
    command.setLogger(getLogger());
    return (EditScmResult) command.execute(repository, fileSet, parameters);
}
Also used : JazzEditCommand(org.apache.maven.scm.provider.jazz.command.edit.JazzEditCommand) UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult)

Example 13 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class SynergyScmProvider method edit.

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

Example 14 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class StarteamScmProvider method edit.

/**
 * {@inheritDoc}
 */
protected EditScmResult edit(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    fileSet = fixUpScmFileSetAbsoluteFilePath(fileSet);
    StarteamEditCommand command = new StarteamEditCommand();
    command.setLogger(getLogger());
    return (EditScmResult) command.execute(repository, fileSet, parameters);
}
Also used : UnEditScmResult(org.apache.maven.scm.command.unedit.UnEditScmResult) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult) StarteamEditCommand(org.apache.maven.scm.provider.starteam.command.edit.StarteamEditCommand)

Example 15 with EditScmResult

use of org.apache.maven.scm.command.edit.EditScmResult in project maven-scm by apache.

the class SynergyEditCommand method executeEditCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeEditCommand(ScmProviderRepository repository, ScmFileSet fileSet) throws ScmException {
    if (getLogger().isDebugEnabled()) {
        getLogger().debug("executing edit command...");
    }
    SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
    if (getLogger().isDebugEnabled()) {
        getLogger().debug(fileSet.toString());
    }
    String ccmAddr = SynergyUtil.start(getLogger(), repo.getUser(), repo.getPassword(), null);
    try {
        String projectSpec = SynergyUtil.getWorkingProject(getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr);
        File waPath = SynergyUtil.getWorkArea(getLogger(), projectSpec, ccmAddr);
        File sourcePath = new File(waPath, repo.getProjectName());
        if (projectSpec == null) {
            throw new ScmException("You should checkout project first");
        }
        int taskNum = SynergyUtil.createTask(getLogger(), "Maven SCM Synergy provider: edit command for project " + repo.getProjectSpec(), repo.getProjectRelease(), true, ccmAddr);
        if (getLogger().isInfoEnabled()) {
            getLogger().info("Task " + taskNum + " was created to perform checkout.");
        }
        for (File f : fileSet.getFileList()) {
            File dest = f;
            File source = new File(sourcePath, SynergyUtil.removePrefix(fileSet.getBasedir(), f));
            List<File> list = new LinkedList<File>();
            list.add(source);
            SynergyUtil.checkoutFiles(getLogger(), list, ccmAddr);
            if (!source.equals(dest)) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Copy file [" + source + "] to expected folder [" + dest + "].");
                }
                try {
                    FileUtils.copyFile(source, dest);
                } catch (IOException e) {
                    throw new ScmException("Unable to copy file from Work Area", e);
                }
            }
        }
    } finally {
        SynergyUtil.stop(getLogger(), ccmAddr);
    }
    List<ScmFile> scmFiles = new ArrayList<ScmFile>(fileSet.getFileList().size());
    for (File f : fileSet.getFileList()) {
        scmFiles.add(new ScmFile(f.getPath(), ScmFileStatus.EDITED));
    }
    return new EditScmResult("", scmFiles);
}
Also used : ScmException(org.apache.maven.scm.ScmException) SynergyScmProviderRepository(org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository) ArrayList(java.util.ArrayList) EditScmResult(org.apache.maven.scm.command.edit.EditScmResult) IOException(java.io.IOException) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) LinkedList(java.util.LinkedList) ScmFile(org.apache.maven.scm.ScmFile)

Aggregations

EditScmResult (org.apache.maven.scm.command.edit.EditScmResult)17 UnEditScmResult (org.apache.maven.scm.command.unedit.UnEditScmResult)5 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)4 Commandline (org.codehaus.plexus.util.cli.Commandline)4 ScmException (org.apache.maven.scm.ScmException)3 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 ScmFile (org.apache.maven.scm.ScmFile)2 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)2 APIException (com.mks.api.response.APIException)1 Response (com.mks.api.response.Response)1 LinkedList (java.util.LinkedList)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ScmFileSet (org.apache.maven.scm.ScmFileSet)1 ClearCaseEditCommand (org.apache.maven.scm.provider.clearcase.command.edit.ClearCaseEditCommand)1 ExceptionHandler (org.apache.maven.scm.provider.integrity.ExceptionHandler)1 Sandbox (org.apache.maven.scm.provider.integrity.Sandbox)1 IntegrityEditCommand (org.apache.maven.scm.provider.integrity.command.edit.IntegrityEditCommand)1 IntegrityScmProviderRepository (org.apache.maven.scm.provider.integrity.repository.IntegrityScmProviderRepository)1