Search in sources :

Example 1 with TfsChangeLogConsumer

use of org.apache.maven.scm.provider.tfs.command.consumer.TfsChangeLogConsumer in project maven-scm by apache.

the class TfsChangeLogCommand method executeChangeLogCommand.

protected ChangeLogScmResult executeChangeLogCommand(ScmProviderRepository r, ScmFileSet f, Date startDate, Date endDate, ScmBranch branch, String datePattern) throws ScmException {
    List<ChangeSet> changeLogs = new ArrayList<ChangeSet>();
    Iterator<File> iter = f.getFileList().iterator();
    if (!iter.hasNext()) {
        List<File> dir = new ArrayList<File>();
        // No files to iterate
        dir.add(f.getBasedir());
        iter = dir.iterator();
    }
    TfsCommand command = null;
    // tf history takes only one file arg
    while (iter.hasNext()) {
        TfsChangeLogConsumer out = new TfsChangeLogConsumer(getLogger());
        ErrorStreamConsumer err = new ErrorStreamConsumer();
        command = createCommand(r, f, ((File) iter.next()));
        int status = command.execute(out, err);
        if (status != 0 || (!out.hasBeenFed() && err.hasBeenFed())) {
            return new ChangeLogScmResult(command.getCommandString(), "Error code for TFS changelog command - " + status, err.getOutput(), false);
        }
        changeLogs.addAll(out.getLogs());
    }
    return new ChangeLogScmResult(command.getCommandString(), new ChangeLogSet(changeLogs, startDate, endDate));
}
Also used : ChangeLogSet(org.apache.maven.scm.command.changelog.ChangeLogSet) ArrayList(java.util.ArrayList) TfsChangeLogConsumer(org.apache.maven.scm.provider.tfs.command.consumer.TfsChangeLogConsumer) ChangeLogScmResult(org.apache.maven.scm.command.changelog.ChangeLogScmResult) ChangeSet(org.apache.maven.scm.ChangeSet) File(java.io.File) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 ChangeSet (org.apache.maven.scm.ChangeSet)1 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)1 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)1 ErrorStreamConsumer (org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)1 TfsChangeLogConsumer (org.apache.maven.scm.provider.tfs.command.consumer.TfsChangeLogConsumer)1