Search in sources :

Example 11 with ScmVersion

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

the class AbstractExportCommand method executeCommand.

/**
 * {@inheritDoc}
 */
protected ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    ScmVersion scmVersion = parameters.getScmVersion(CommandParameter.SCM_VERSION, null);
    String outputDirectory = parameters.getString(CommandParameter.OUTPUT_DIRECTORY, null);
    return executeExportCommand(repository, fileSet, scmVersion, outputDirectory);
}
Also used : ScmVersion(org.apache.maven.scm.ScmVersion)

Example 12 with ScmVersion

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

the class GitChangeLogCommand method executeChangeLogCommand.

@Override
protected ChangeLogScmResult executeChangeLogCommand(ChangeLogScmRequest request) throws ScmException {
    final ScmVersion startVersion = request.getStartRevision();
    final ScmVersion endVersion = request.getEndRevision();
    final ScmFileSet fileSet = request.getScmFileSet();
    final String datePattern = request.getDatePattern();
    return executeChangeLogCommand(request.getScmRepository().getProviderRepository(), fileSet, request.getStartDate(), request.getEndDate(), request.getScmBranch(), datePattern, startVersion, endVersion, request.getLimit());
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmVersion(org.apache.maven.scm.ScmVersion)

Example 13 with ScmVersion

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

the class AbstractScmProvider method changeLog.

/**
 * {@inheritDoc}
 *
 * @deprecated
 */
public ChangeLogScmResult changeLog(ScmRepository repository, ScmFileSet fileSet, String startTag, String endTag, String datePattern) throws ScmException {
    ScmVersion startRevision = null;
    ScmVersion endRevision = null;
    if (StringUtils.isNotEmpty(startTag)) {
        startRevision = new ScmRevision(startTag);
    }
    if (StringUtils.isNotEmpty(endTag)) {
        endRevision = new ScmRevision(endTag);
    }
    return changeLog(repository, fileSet, startRevision, endRevision, null);
}
Also used : ScmRevision(org.apache.maven.scm.ScmRevision) ScmVersion(org.apache.maven.scm.ScmVersion)

Example 14 with ScmVersion

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

the class AbstractUpdateCommand method executeCommand.

/**
 * {@inheritDoc}
 */
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    ScmVersion scmVersion = parameters.getScmVersion(CommandParameter.SCM_VERSION, null);
    boolean runChangelog = Boolean.valueOf(parameters.getString(CommandParameter.RUN_CHANGELOG_WITH_UPDATE, "true")).booleanValue();
    UpdateScmResult updateScmResult = executeUpdateCommand(repository, fileSet, scmVersion);
    List<ScmFile> filesList = updateScmResult.getUpdatedFiles();
    if (!runChangelog) {
        return updateScmResult;
    }
    ChangeLogCommand changeLogCmd = getChangeLogCommand();
    if (filesList != null && filesList.size() > 0 && changeLogCmd != null) {
        ChangeLogScmResult changeLogScmResult = (ChangeLogScmResult) changeLogCmd.executeCommand(repository, fileSet, parameters);
        List<ChangeSet> changes = new ArrayList<ChangeSet>();
        ChangeLogSet changeLogSet = changeLogScmResult.getChangeLog();
        if (changeLogSet != null) {
            Date startDate = null;
            try {
                startDate = parameters.getDate(CommandParameter.START_DATE);
            } catch (ScmException e) {
            // Do nothing, startDate isn't define.
            }
            for (ChangeSet change : changeLogSet.getChangeSets()) {
                if (startDate != null && change.getDate() != null) {
                    if (startDate.after(change.getDate())) {
                        continue;
                    }
                }
                for (ScmFile currentFile : filesList) {
                    if (change.containsFilename(currentFile.getPath())) {
                        changes.add(change);
                        break;
                    }
                }
            }
        }
        updateScmResult.setChanges(changes);
    }
    return updateScmResult;
}
Also used : ScmException(org.apache.maven.scm.ScmException) ChangeLogSet(org.apache.maven.scm.command.changelog.ChangeLogSet) ArrayList(java.util.ArrayList) Date(java.util.Date) ScmVersion(org.apache.maven.scm.ScmVersion) ScmFile(org.apache.maven.scm.ScmFile) ChangeLogScmResult(org.apache.maven.scm.command.changelog.ChangeLogScmResult) ChangeLogCommand(org.apache.maven.scm.command.changelog.ChangeLogCommand) ChangeSet(org.apache.maven.scm.ChangeSet)

Example 15 with ScmVersion

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

the class AbstractListCommand method executeCommand.

/**
 * {@inheritDoc}
 */
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    if (fileSet.getFileList().isEmpty()) {
        throw new IllegalArgumentException("fileSet can not be empty");
    }
    boolean recursive = parameters.getBoolean(CommandParameter.RECURSIVE);
    ScmVersion scmVersion = parameters.getScmVersion(CommandParameter.SCM_VERSION, null);
    return executeListCommand(repository, fileSet, recursive, scmVersion);
}
Also used : ScmVersion(org.apache.maven.scm.ScmVersion)

Aggregations

ScmVersion (org.apache.maven.scm.ScmVersion)19 ScmException (org.apache.maven.scm.ScmException)6 ScmBranch (org.apache.maven.scm.ScmBranch)4 ScmFileSet (org.apache.maven.scm.ScmFileSet)4 ScmRevision (org.apache.maven.scm.ScmRevision)4 File (java.io.File)3 Date (java.util.Date)3 ScmFile (org.apache.maven.scm.ScmFile)3 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)3 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)3 AccuRevVersion (org.apache.maven.scm.provider.accurev.AccuRevVersion)3 IOException (java.io.IOException)2 ChangeSet (org.apache.maven.scm.ChangeSet)2 ScmProviderRepository (org.apache.maven.scm.provider.ScmProviderRepository)2 AccuRev (org.apache.maven.scm.provider.accurev.AccuRev)2 AccuRevException (org.apache.maven.scm.provider.accurev.AccuRevException)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ScmTag (org.apache.maven.scm.ScmTag)1