Search in sources :

Example 1 with CLIOutputResponseList

use of org.eclipse.che.plugin.svn.shared.CLIOutputResponseList in project che by eclipse.

the class SubversionClientServiceImpl method resolve.

@Override
public Promise<CLIOutputResponseList> resolve(Path project, Map<String, String> resolutions, String depth) {
    final String url = getBaseUrl() + "/resolve";
    final ResolveRequest request = dtoFactory.createDto(ResolveRequest.class).withProjectPath(project.toString()).withConflictResolutions(resolutions).withDepth(depth);
    return asyncRequestFactory.createPostRequest(url, request).loader(loader).send(dtoUnmarshallerFactory.newUnmarshaller(CLIOutputResponseList.class));
}
Also used : CLIOutputResponseList(org.eclipse.che.plugin.svn.shared.CLIOutputResponseList) ResolveRequest(org.eclipse.che.plugin.svn.shared.ResolveRequest)

Example 2 with CLIOutputResponseList

use of org.eclipse.che.plugin.svn.shared.CLIOutputResponseList in project che by eclipse.

the class ResolvePresenter method onResolveClicked.

@Override
public void onResolveClicked() {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    HashMap<String, String> filesConflictResolutionActions = new HashMap<String, String>();
    Iterator<String> iterConflicts = conflictsList.iterator();
    while (iterConflicts.hasNext()) {
        String path = iterConflicts.next();
        String resolutionActionText = view.getConflictResolutionAction(path);
        if (!resolutionActionText.equals(ConflictResolutionAction.POSTPONE.getText())) {
            filesConflictResolutionActions.put(path, resolutionActionText);
            iterConflicts.remove();
        }
    }
    if (filesConflictResolutionActions.size() > 0) {
        service.resolve(project.getLocation(), filesConflictResolutionActions, "infinity").then(new Operation<CLIOutputResponseList>() {

            @Override
            public void apply(CLIOutputResponseList response) throws OperationException {
                for (CLIOutputResponse outputResponse : response.getCLIOutputResponses()) {
                    printResponse(outputResponse.getCommand(), outputResponse.getOutput(), null, constants.commandResolve());
                }
            }
        }).catchError(new Operation<PromiseError>() {

            @Override
            public void apply(PromiseError error) throws OperationException {
                notificationManager.notify(error.getMessage(), FAIL, FLOAT_MODE);
            }
        });
    }
    view.close();
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) CLIOutputResponseList(org.eclipse.che.plugin.svn.shared.CLIOutputResponseList) PromiseError(org.eclipse.che.api.promises.client.PromiseError) HashMap(java.util.HashMap) Operation(org.eclipse.che.api.promises.client.Operation) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 3 with CLIOutputResponseList

use of org.eclipse.che.plugin.svn.shared.CLIOutputResponseList 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);
}
Also used : CommandLineResult(org.eclipse.che.plugin.svn.server.upstream.CommandLineResult) CLIOutputResponseList(org.eclipse.che.plugin.svn.shared.CLIOutputResponseList) ArrayList(java.util.ArrayList) CLIOutputResponse(org.eclipse.che.plugin.svn.shared.CLIOutputResponse) File(java.io.File)

Aggregations

CLIOutputResponseList (org.eclipse.che.plugin.svn.shared.CLIOutputResponseList)3 CLIOutputResponse (org.eclipse.che.plugin.svn.shared.CLIOutputResponse)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Operation (org.eclipse.che.api.promises.client.Operation)1 OperationException (org.eclipse.che.api.promises.client.OperationException)1 PromiseError (org.eclipse.che.api.promises.client.PromiseError)1 Project (org.eclipse.che.ide.api.resources.Project)1 CommandLineResult (org.eclipse.che.plugin.svn.server.upstream.CommandLineResult)1 ResolveRequest (org.eclipse.che.plugin.svn.shared.ResolveRequest)1