use of org.eclipse.che.plugin.svn.server.upstream.CommandLineResult in project che by eclipse.
the class SubversionApi method propget.
/**
* Perform an "svn propget" based on the request.
*
* @param request
* the request
* @return the response
* @throws IOException
* if there is a problem executing the command
* @throws ServerException
* if there is a Subversion issue
*/
public CLIOutputResponse propget(final PropertyGetRequest request) throws IOException, ServerException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
final List<String> uArgs = defaultArgs();
uArgs.add("propget");
uArgs.add(request.getName());
final CommandLineResult result = runCommand(null, uArgs, projectPath, Arrays.asList(request.getPath()));
return DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout());
}
use of org.eclipse.che.plugin.svn.server.upstream.CommandLineResult in project che by eclipse.
the class SubversionApi method add.
/**
* Perform an "svn add" 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 add(final AddRequest request) throws IOException, SubversionException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
final List<String> args = defaultArgs();
// Flags
addFlag(args, "--no-ignore", request.isAddIgnored());
addFlag(args, "--parents", request.isAddParents());
if (request.isAutoProps()) {
args.add("--auto-props");
}
if (request.isNotAutoProps()) {
args.add("--no-auto-props");
}
// Options
addOption(args, "--depth", request.getDepth());
// Command Name
args.add("add");
// Command Arguments
final CommandLineResult result = runCommand(null, args, 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.server.upstream.CommandLineResult in project che by eclipse.
the class SubversionApi method propdel.
/**
* Perform an "svn propdel" based on the request.
*
* @param request
* the request
* @return the response
* @throws IOException
* if there is a problem executing the command
* @throws ServerException
* if there is a Subversion issue
*/
public CLIOutputResponse propdel(final PropertyDeleteRequest request) throws IOException, ServerException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
final List<String> uArgs = defaultArgs();
addDepth(uArgs, request.getDepth().getValue());
uArgs.add("propdel");
uArgs.add(request.getName());
final CommandLineResult result = runCommand(null, uArgs, projectPath, Arrays.asList(request.getPath()));
return DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
}
use of org.eclipse.che.plugin.svn.server.upstream.CommandLineResult in project che by eclipse.
the class SubversionApi method move.
/**
* Perform an "svn move" 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 move(final MoveRequest request) throws IOException, SubversionException, UnauthorizedException {
Predicate<String> sourcePredicate = new Predicate<String>() {
@Override
public boolean apply(String input) {
return input.startsWith("file://");
}
};
//for security reason we should forbid file protocol
if (Iterables.any(request.getSource(), sourcePredicate) || 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("move");
final List<String> paths = new ArrayList<>();
paths.addAll(request.getSource());
paths.add(request.getDestination());
final CommandLineResult result = runCommand(null, cliArgs, projectPath, paths, 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.server.upstream.CommandLineResult in project che by eclipse.
the class SubversionApi method resolve.
/**
* Perform an "svn resolve" 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 CLIOutputResponseList resolve(final ResolveRequest request) throws IOException, SubversionException, UnauthorizedException {
final File projectPath = new File(request.getProjectPath());
Map<String, String> resolutions = request.getConflictResolutions();
List<CLIOutputResponse> results = new ArrayList<>();
for (String path : resolutions.keySet()) {
final List<String> uArgs = defaultArgs();
addDepth(uArgs, request.getDepth());
addOption(uArgs, "--accept", resolutions.get(path));
uArgs.add("resolve");
final CommandLineResult result = runCommand(null, uArgs, projectPath, Arrays.asList(path));
CLIOutputResponse outputResponse = DtoFactory.getInstance().createDto(CLIOutputResponse.class).withCommand(result.getCommandLine().toString()).withOutput(result.getStdout()).withErrOutput(result.getStderr());
results.add(outputResponse);
}
return DtoFactory.getInstance().createDto(CLIOutputResponseList.class).withCLIOutputResponses(results);
}
Aggregations