public PullRequestImpl(org.eclipse.che.api.git.shared.PullRequest origin) { this.password = origin.getPassword(); this.rebase = origin.getRebase(); this.timeout = origin.getTimeout(); this.refSpec = origin.getRefSpec(); this.remote = origin.getRemote(); this.username = origin.getUsername(); }
@Override public Promise<PullResponse> pull( Path project, String refSpec, String remote, boolean rebase, Credentials credentials) { PullRequest pullRequest = dtoFactory .createDto(PullRequest.class) .withRemote(remote) .withRefSpec(refSpec) .withRebase(rebase); if (credentials != null) { pullRequest.setUsername(credentials.getUsername()); pullRequest.setPassword(credentials.getPassword()); } String url = getWsAgentBaseUrl() + PULL + "?projectPath=" + encodePath(project); return asyncRequestFactory .createPostRequest(url, pullRequest) .send(dtoUnmarshallerFactory.newUnmarshaller(PullResponse.class)); }
@POST @Path("pull") @Consumes(MediaType.APPLICATION_JSON) public PullResponse pull(PullRequest request) throws ApiException { try (GitConnection gitConnection = getGitConnection()) { return gitConnection.pull( PullParams.create(request.getRemote()) .withRefSpec(request.getRefSpec()) .withRebase(request.getRebase()) .withTimeout(request.getTimeout()) .withUsername(request.getUsername()) .withPassword(request.getPassword())); } }