Search in sources :

Example 41 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class ListMojo method execute.

/**
 * {@inheritDoc}
 */
public void execute() throws MojoExecutionException {
    super.execute();
    try {
        ScmRepository repository = getScmRepository();
        ListScmResult result = getScmManager().list(repository, getFileSet(), recursive, getScmVersion(scmVersionType, scmVersion));
        checkResult(result);
        if (result.getFiles() != null) {
            for (ScmFile scmFile : result.getFiles()) {
                getLog().info(scmFile.getPath());
            }
        }
    } catch (ScmException e) {
        throw new MojoExecutionException("Cannot run list command : ", e);
    } catch (IOException e) {
        throw new MojoExecutionException("Cannot run list command : ", e);
    }
}
Also used : ScmRepository(org.apache.maven.scm.repository.ScmRepository) ScmException(org.apache.maven.scm.ScmException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ListScmResult(org.apache.maven.scm.command.list.ListScmResult) IOException(java.io.IOException) ScmFile(org.apache.maven.scm.ScmFile)

Example 42 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class AccuRevRemoveCommand method executeAccurevCommand.

@Override
protected ScmResult executeAccurevCommand(AccuRevScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException, AccuRevException {
    AccuRev accuRev = repository.getAccuRev();
    String message = parameters.getString(CommandParameter.MESSAGE, "");
    File basedir = fileSet.getBasedir();
    List<File> relativeFiles = fileSet.getFileList();
    final List<File> removedFiles = accuRev.defunct(basedir, relativeFiles, message);
    if (removedFiles != null) {
        List<ScmFile> resultFiles = getScmFiles(removedFiles, ScmFileStatus.DELETED);
        return new RemoveScmResult(accuRev.getCommandLines(), resultFiles);
    } else {
        return new RemoveScmResult(accuRev.getCommandLines(), "AccuRev Error", accuRev.getErrorOutput(), false);
    }
}
Also used : AccuRev(org.apache.maven.scm.provider.accurev.AccuRev) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) RemoveScmResult(org.apache.maven.scm.command.remove.RemoveScmResult) ScmFile(org.apache.maven.scm.ScmFile)

Example 43 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class VssCheckInConsumer method processGetFile.

/**
 * Process the current input line in the Get File state.
 *
 * @param line a line of text from the VSS log output
 */
private void processGetFile(String line) {
    String[] fileLine = line.split(" ");
    updatedFiles.add(new ScmFile(currentPath + "/" + fileLine[1], ScmFileStatus.UPDATED));
    if (getLogger().isInfoEnabled()) {
        getLogger().info(fileLine[0] + ": " + currentPath + "/" + fileLine[1]);
    }
}
Also used : ScmFile(org.apache.maven.scm.ScmFile)

Example 44 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class VssEditConsumer method processGetFile.

/**
 * Process the current input line in the Get File state.
 *
 * @param line a line of text from the VSS log output
 */
private void processGetFile(String line) {
    String[] fileLine = line.split(" ");
    updatedFiles.add(new ScmFile(currentPath + "/" + fileLine[1], ScmFileStatus.EDITED));
    if (getLogger().isInfoEnabled()) {
        getLogger().info(fileLine[0] + ": " + currentPath + "/" + fileLine[1]);
    }
}
Also used : ScmFile(org.apache.maven.scm.ScmFile)

Example 45 with ScmFile

use of org.apache.maven.scm.ScmFile in project maven-scm by apache.

the class VssStatusConsumer method processLastStateFiles.

/**
 * Process the current input line in the Get File state.
 *
 * @param line a line of text from the VSS log output
 */
private void processLastStateFiles(String line) {
    if (line != null && line.trim().length() > 0) {
        if (lastState == DIFF_START_DIFFING_LOCAL) {
            setLocalFolder(localFolder + line);
            getLogger().debug("Local folder: " + localFolder);
        } else if (lastState == DIFF_START_DIFFING_REMOTE) {
            setRemoteProjectFolder(remoteProjectFolder + line);
            getLogger().debug("Remote folder: " + localFolder);
        }
        String[] fileLine = line.split(" ");
        for (int i = 0; i < fileLine.length; i++) {
            if (fileLine[i].trim().length() > 0) {
                if (lastState == DIFF_LOCAL_FILES_NOT_IN_PROJECT) {
                    updatedFiles.add(new ScmFile(localFolder + fileLine[i], ScmFileStatus.ADDED));
                } else if (lastState == DIFF_VSS_FILES_NOT_IN_CURRENT_FOLDER) {
                    updatedFiles.add(new ScmFile(localFolder + fileLine[i], ScmFileStatus.UPDATED));
                } else if (lastState == DIFF_VSS_FILES_DIFFERENT_FROM_LOCAL_FILES) {
                    updatedFiles.add(new ScmFile(localFolder + fileLine[i], ScmFileStatus.MODIFIED));
                }
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug(localFolder + fileLine[i]);
                }
            }
        }
    } else {
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("processLastStateFiles:  empty line");
        }
    }
}
Also used : ScmFile(org.apache.maven.scm.ScmFile)

Aggregations

ScmFile (org.apache.maven.scm.ScmFile)198 File (java.io.File)102 ArrayList (java.util.ArrayList)51 ScmException (org.apache.maven.scm.ScmException)34 BufferedReader (java.io.BufferedReader)21 DefaultLog (org.apache.maven.scm.log.DefaultLog)20 ScmFileStatus (org.apache.maven.scm.ScmFileStatus)19 ScmFileSet (org.apache.maven.scm.ScmFileSet)17 InputStreamReader (java.io.InputStreamReader)16 ScmResult (org.apache.maven.scm.ScmResult)15 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)15 IOException (java.io.IOException)14 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)13 Matcher (java.util.regex.Matcher)11 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)11 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)10 UpdateScmResult (org.apache.maven.scm.command.update.UpdateScmResult)10 Commandline (org.codehaus.plexus.util.cli.Commandline)10 SynergyScmProviderRepository (org.apache.maven.scm.provider.synergy.repository.SynergyScmProviderRepository)9 FileInputStream (java.io.FileInputStream)8