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));
}
Aggregations