PullCommand command = getWrappedObject().pull(); command.setRemote(remote);
protected void doPull(Exchange exchange, String operation) throws Exception { PullResult result = null; try { if (ObjectHelper.isEmpty(endpoint.getRemoteName())) { throw new IllegalArgumentException("Remote name must be specified to execute " + operation); } if (ObjectHelper.isNotEmpty(endpoint.getBranchName())) { git.checkout().setCreateBranch(false).setName(endpoint.getBranchName()).call(); } if (ObjectHelper.isNotEmpty(endpoint.getUsername()) && ObjectHelper.isNotEmpty(endpoint.getPassword())) { UsernamePasswordCredentialsProvider credentials = new UsernamePasswordCredentialsProvider(endpoint.getUsername(), endpoint.getPassword()); result = git.pull().setCredentialsProvider(credentials).setRemote(endpoint.getRemoteName()).call(); } else { result = git.pull().setRemote(endpoint.getRemoteName()).call(); } } catch (Exception e) { LOG.error("There was an error in Git {} operation", operation); throw e; } updateExchange(exchange, result); }
/** * Pull repository from current branch and remote branch with same name as current * * @param git * instance. * @param remote * to be used. * @param remoteBranch * to use. */ public PullResult pullFromRepository(Git git, String remote, String remoteBranch) { try { return git.pull() .setRemote(remote) .setRemoteBranchName(remoteBranch) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
PullCommand pullCommand = localGit.pull(); pullCommand.setRemote("origin").setCredentialsProvider( new UsernamePasswordCredentialsProvider(tacGitlabProperties.getUserName(), tacGitlabProperties.getPassword())).setTimeout(30);
public void pull(String branch) throws Exception { PullCommand pull = git.pull().setRemote("origin").setRemoteBranchName(branch); if (credentialsProvider != null) pull.setCredentialsProvider(credentialsProvider); pull.call(); }
PullCommand pullCommand = localGit.pull(); pullCommand.setRemote("origin").setCredentialsProvider( new UsernamePasswordCredentialsProvider(tacGitlabProperties.getUserName(), tacGitlabProperties.getPassword())).setTimeout(30);
/** * Pull repository from current branch and remote branch with same name as current * * @param git * instance. * @param remote * to be used. * @param remoteBranch * to use. * @param username * to connect * @param password * to connect */ public PullResult pullFromRepository(Git git, String remote, String remoteBranch, String username, String password) { try { return git.pull() .setRemote(remote) .setRemoteBranchName(remoteBranch) .setCredentialsProvider(new UsernamePasswordCredentialsProvider(username, password)) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
public static Boolean pullAndRebase(final Git git) { Boolean result = Boolean.FALSE; try { git.reset().setMode(ResetCommand.ResetType.HARD).call(); final RebaseResult rr = git.pull().setRemote(REMOTE).setRebase(Boolean.TRUE).call().getRebaseResult(); if (rr.getStatus().equals(RebaseResult.Status.UP_TO_DATE) || rr.getStatus().equals(RebaseResult.Status.FAST_FORWARD)) { result = Boolean.TRUE; } if (rr.getStatus().equals(RebaseResult.Status.UNCOMMITTED_CHANGES)) { PullResult pr = git.pull().call(); if (pr.isSuccessful()) { result = Boolean.TRUE; } else { result = Boolean.FALSE; } } } catch (Exception e) { logger.error(e.getMessage()); } return result; }
public void pullRepo() { try { git.pull().setRemote(REMOTE_NAME).setRemoteBranchName(MASTER_BRANCH).setRebase(false).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } }
assertNotNull(model); PullCommand pc = cloned.pull().setRemote("origin").setRebase(Boolean.TRUE); PullResult pullRes = pc.call(); assertEquals(pullRes.getRebaseResult().getStatus(), RebaseResult.Status.UP_TO_DATE);
.setRemote(remote) .setRemoteBranchName(remoteBranch) .setTransportConfigCallback(transport -> {
String current = git.getRepository().getBranch(); if (branch.equalsIgnoreCase(current)) { PullResult pull = git.pull().setRemote(remote).setCredentialsProvider(credentialProvider) .setTransportConfigCallback(transportConfigCallback).call(); if (!pull.isSuccessful()) {
public void pullRepo(String uri, String branch) { try { setRemote(uri); git.pull().setRemote(REMOTE_NAME).setRemoteBranchName(branch).setRebase(false).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } }
String current = git.getRepository().getBranch(); if (branch.equalsIgnoreCase(current)) { PullResult pull = git.pull().setRemote(remote).setCredentialsProvider(credentialProvider) .setTransportConfigCallback(transportConfigCallback).call(); if (!pull.isSuccessful()) {
private Future<Void> update() { Future<Void> result = Future.future(); vertx.executeBlocking( future -> { PullResult call; try { call = git.pull().setRemote(remote).setRemoteBranchName(branch).call(); } catch (GitAPIException e) { future.fail(e); return; } if (call.isSuccessful()) { future.complete(); } else { if (call.getMergeResult() != null) { future.fail("Unable to merge repository - Conflicts: " + call.getMergeResult().getCheckoutConflicts()); } else { future.fail("Unable to rebase repository - Conflicts: " + call.getRebaseResult().getConflicts()); } } }, result.completer() ); return result; }
.setRemote(mRemote) .setProgressMonitor(new BasicProgressMonitor()) .setTransportConfigCallback(new SgitTransportCallback());
private Future<Void> update() { Future<Void> result = Future.future(); vertx.executeBlocking( future -> { PullResult call; try { call = git.pull().setRemote(remote).setRemoteBranchName(branch).call(); } catch (GitAPIException e) { future.fail(e); return; } if (call.isSuccessful()) { future.complete(); } else { if (call.getMergeResult() != null) { future.fail("Unable to merge repository - Conflicts: " + call.getMergeResult().getCheckoutConflicts()); } else { future.fail("Unable to rebase repository - Conflicts: " + call.getRebaseResult().getConflicts()); } } }, result.completer() ); return result; }
.setRemote(mRemote) .setProgressMonitor(new BasicProgressMonitor()) .setTransportConfigCallback(new SgitTransportCallback());
public void pullRepo(String uri, String branch, GitUser user) { try { setRemote(uri); git.pull().setRemote(REMOTE_NAME).setRemoteBranchName(branch).setRebase(false) .setCredentialsProvider(new UsernamePasswordCredentialsProvider(user.getUsername(), user.getPassword())).call(); } catch (InvalidRemoteException e) { e.printStackTrace(); } catch (TransportException e) { e.printStackTrace(); } catch (GitAPIException e) { e.printStackTrace(); } }
/** * Pull from upstream * * @param git * @param stash * @param newBranch * @param previousBranch * @throws Exception */ private void pullFromRemoteUpstream(Git git, RevCommit stash, String newBranch, String previousBranch) throws Exception { try { PullCommand pull = git.pull() .setRebase(true) .setRemote(UPSTREAM) .setRemoteBranchName(branch); PullResult pullResult = pull.call(); if(!pullResult.isSuccessful()){ rebaseAbort(git); checkoutBranch(git, previousBranch); if (stash != null) { git.stashApply().setStashRef(stash.getName()).call(); } deleteTempBranch(git, newBranch); throw new Exception(CONFLICT_MESSAGE_REASON); } } catch (GitAPIException e) { throw new Exception(PULL_COMMAND_PROBLEM_REASON, e); } }