use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsAddCommand method executeAddCommand.
protected ScmResult executeAddCommand(ScmProviderRepository r, ScmFileSet f, String m, boolean b) throws ScmException {
TfsCommand command = createCommand(r, f);
FileListConsumer fileConsumer = new FileListConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
int status = command.execute(fileConsumer, err);
if (status != 0 || err.hasBeenFed()) {
return new AddScmResult(command.getCommandString(), "Error code for TFS add command - " + status, err.getOutput(), false);
}
return new AddScmResult(command.getCommandString(), fileConsumer.getFiles());
}
use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsCheckOutCommand method createWorkspace.
private void createWorkspace(ScmProviderRepository r, ScmFileSet f, String workspace, String url) throws ScmException {
ErrorStreamConsumer out = new ErrorStreamConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
// Checkout dir may not exist yet
TfsCommand command = new TfsCommand("workspace", r, null, getLogger());
command.addArgument("-new");
command.addArgument("-comment:Creating workspace for maven command");
command.addArgument("-server:" + url);
command.addArgument(workspace);
command.execute(out, err);
}
use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsCheckOutCommand method executeCheckOutCommand.
protected CheckOutScmResult executeCheckOutCommand(ScmProviderRepository r, ScmFileSet f, ScmVersion v, boolean recursive, boolean shallow) throws ScmException {
TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
String url = tfsRepo.getServerPath();
String tfsUrl = tfsRepo.getTfsUrl();
String workspace = tfsRepo.getWorkspace();
// Try creating workspace
boolean workspaceProvided = workspace != null && !workspace.trim().equals("");
if (workspaceProvided) {
createWorkspace(r, f, workspace, tfsUrl);
}
TfsCommand command;
int status;
if (workspaceProvided) {
status = executeUnmapCommand(r, f);
}
ErrorStreamConsumer out = new ErrorStreamConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
if (workspaceProvided) {
command = new TfsCommand("workfold", r, null, getLogger());
command.addArgument("-workspace:" + workspace);
command.addArgument("-map");
command.addArgument(url);
command.addArgument(f.getBasedir().getAbsolutePath());
status = command.execute(out, err);
if (status != 0 || err.hasBeenFed()) {
return new CheckOutScmResult(command.getCommandString(), "Error code for TFS checkout (workfold map) command - " + status, err.getOutput(), false);
}
}
FileListConsumer fileConsumer = new FileListConsumer();
err = new ErrorStreamConsumer();
command = createGetCommand(r, f, v, recursive);
status = command.execute(fileConsumer, err);
if (status != 0 || err.hasBeenFed()) {
return new CheckOutScmResult(command.getCommandString(), "Error code for TFS checkout (get) command - " + status, err.getOutput(), false);
}
return new CheckOutScmResult(command.getCommandString(), fileConsumer.getFiles());
}
use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsEditCommand method executeEditCommand.
protected ScmResult executeEditCommand(ScmProviderRepository r, ScmFileSet f) throws ScmException {
FileListConsumer out = new FileListConsumer();
ErrorStreamConsumer err = new ErrorStreamConsumer();
TfsCommand command = createCommand(r, f);
int status = command.execute(out, err);
if (status != 0 || err.hasBeenFed()) {
return new EditScmResult(command.getCommandString(), "Error code for TFS edit command - " + status, err.getOutput(), false);
}
return new EditScmResult(command.getCommandString(), out.getFiles());
}
use of org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer in project maven-scm by apache.
the class TfsStatusCommand method executeStatusCommand.
protected StatusScmResult executeStatusCommand(ScmProviderRepository r, ScmFileSet f) throws ScmException {
TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
TfsCommand command = createCommand(tfsRepo, f);
ChangedFileConsumer out = new ChangedFileConsumer(getLogger());
ErrorStreamConsumer err = new ErrorStreamConsumer();
int status = command.execute(out, err);
if (status != 0 || err.hasBeenFed()) {
return new StatusScmResult(command.getCommandString(), "Error code for TFS status command - " + status, err.getOutput(), false);
}
Iterator<ScmFile> iter = out.getChangedFiles().iterator();
getLogger().debug("Iterating");
while (iter.hasNext()) {
ScmFile file = (ScmFile) iter.next();
getLogger().debug(file.getPath() + ":" + file.getStatus());
}
return new StatusScmResult(command.getCommandString(), out.getChangedFiles());
}
Aggregations