use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class SubversionApi method lockUnlock.
public CLIOutputResponse lockUnlock(final LockRequest request, final boolean lock) throws IOException, SubversionException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
final List<String> args = defaultArgs();
addFlag(args, "--force", request.isForce());
// command
if (lock) {
args.add("lock");
} else {
args.add("unlock");
}
final CommandLineResult result = runCommand(null, args, projectPath, request.getTargets(), request.getUsername(), request.getPassword());
return DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class SubversionApi method showLog.
/**
* Perform an "svn log" based on the request.
*
* @param request
* the request
* @return the response
* @throws IOException
* if there is a problem executing the command
* @throws SubversionException
* if there is a Subversion issue
*/
public CLIOutputResponse showLog(final ShowLogRequest request) throws IOException, SubversionException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
final List<String> uArgs = defaultArgs();
addOption(uArgs, "--revision", request.getRevision());
uArgs.add("log");
final CommandLineResult result = runCommand(null, uArgs, projectPath, request.getPaths());
return DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class SubversionApi method copy.
/**
* Perform an "svn copy" based on the request.
*
* @param request
* the request
* @return the response
* @throws IOException
* if there is a problem executing the command
* @throws SubversionException
* if there is a Subversion issue
*/
public CLIOutputResponse copy(final CopyRequest request) throws IOException, SubversionException, UnauthorizedException {
//for security reason we should forbid file protocol
if (request.getSource().startsWith("file://") || request.getDestination().startsWith("file://")) {
throw new SubversionException("Url is not acceptable");
}
final File projectPath = new File(request.getProjectPath());
final List<String> cliArgs = defaultArgs();
if (!isNullOrEmpty(request.getComment())) {
addOption(cliArgs, "--message", "\"" + request.getComment() + "\"");
}
// Command Name
cliArgs.add("copy");
final CommandLineResult result = runCommand(null, cliArgs, projectPath, Arrays.asList(request.getSource(), request.getDestination()), request.getUsername(), request.getPassword());
return DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class SubversionApi method showDiff.
/**
* Perform an "svn diff" based on the request.
*
* @param request
* the request
* @return the response
* @throws IOException
* if there is a problem executing the command
* @throws SubversionException
* if there is a Subversion issue
*/
public CLIOutputResponse showDiff(final ShowDiffRequest request) throws IOException, SubversionException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
final List<String> uArgs = defaultArgs();
addOption(uArgs, "--revision", request.getRevision());
uArgs.add("diff");
final CommandLineResult result = runCommand(null, uArgs, projectPath, request.getPaths(), request.getUsername(), request.getPassword());
return DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputResponse in project che by eclipse.
the class ResolvePresenter method showConflictsDialog.
public void showConflictsDialog() {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
service.showConflicts(project.getLocation(), toRelative(project, resources)).then(new Operation<CLIOutputResponse>() {
@Override
public void apply(CLIOutputResponse response) throws OperationException {
conflictsList = parseConflictsList(response.getOutput());
if (conflictsList.isEmpty()) {
dialogFactory.createMessageDialog(constants.resolveNoConflictTitle(), constants.resolveNoConflictContent(), null).show();
return;
}
for (String file : conflictsList) {
view.addConflictingFile(file);
}
view.showDialog();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
}
});
}
Aggregations