use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsTagCommand method executeTagCommand.
protected ScmResult executeTagCommand(ScmProviderRepository r, ScmFileSet f, String tag, ScmTagParameters scmTagParameters) throws ScmException {
TfsCommand command = createCommand(r, f, tag, scmTagParameters);
StringStreamConsumer out = new StringStreamConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
int status = command.execute(out, err);
if (status != 0 || err.hasBeenFed()) {
return new TagScmResult(command.getCommandString(), "Error code for TFS label command - " + status, err.getOutput(), false);
}
List<ScmFile> files = new ArrayList<ScmFile>(f.getFileList().size());
for (File file : f.getFileList()) {
files.add(new ScmFile(file.getPath(), ScmFileStatus.TAGGED));
}
return new TagScmResult(command.getCommandString(), files);
}
use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer 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));
}
use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsBranchCommand method executeBranchCommand.
protected ScmResult executeBranchCommand(ScmProviderRepository r, ScmFileSet f, String branch, String message) throws ScmException {
TfsCommand command = createCommand(r, f, branch);
StringStreamConsumer out = new StringStreamConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
int status = command.execute(out, err);
getLogger().info("status of branch command is= " + status + "; err= " + err.getOutput());
if (status != 0 || err.hasBeenFed()) {
return new BranchScmResult(command.getCommandString(), "Error code for TFS branch command - " + status, err.getOutput(), false);
}
return new BranchScmResult(command.getCommandString(), new ArrayList<ScmFile>(0));
}
use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsCheckOutCommand method executeUnmapCommand.
public int executeUnmapCommand(ScmProviderRepository r, ScmFileSet f) throws ScmException {
TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
String url = tfsRepo.getServerPath();
String workspace = tfsRepo.getWorkspace();
ErrorStreamConsumer out = new ErrorStreamConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
TfsCommand command = new TfsCommand("workfold", r, null, getLogger());
command.addArgument("-workspace:" + workspace);
command.addArgument("-unmap");
command.addArgument(url);
return command.execute(out, err);
}
use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsUpdateCommand method executeUpdateCommand.
protected UpdateScmResult executeUpdateCommand(ScmProviderRepository r, ScmFileSet f, ScmVersion v) throws ScmException {
FileListConsumer fileConsumer = new FileListConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
TfsCommand command = createCommand(r, f, v);
int status = command.execute(fileConsumer, err);
if (status != 0 || err.hasBeenFed()) {
return new UpdateScmResult(command.getCommandString(), "Error code for TFS update command - " + status, err.getOutput(), false);
}
return new UpdateScmResult(command.getCommandString(), fileConsumer.getFiles());
}
Aggregations