private PullCommand pullCommand(String branch, Git git) { if (Strings.isNullOrEmpty(branch)) { return buildCommand(git.pull()); } return buildCommand(git.pull().setRemoteBranchName(branch)).setTimeout(GIT_TRANS_TIMEOUT); }
command.setRemoteBranchName(branch.toString());
/** * Updates the current repository * * @throws IOException if the Git pull goes wrong of if the directory cannot * be found */ public void updateRepository() throws IOException { try { System.out.println("[+]Started updating " + name); Git git = Git.open(directory); if (git.pull().setRemoteBranchName(branch).call().isSuccessful()) { System.out.println("[+]Git pull succesful for " + name); } } catch (GitAPIException ex) { //Because the GitAPIException is abstract and cannot be instantiated, another (similar) exception is used throw new IOException("[+]Git pull failed, AndroidProjectCreator will now exit"); } catch (IOException ex) { throw new IOException("Directory not found, reinstall AndroidProjectCreator and check your permissions in this folder. AndroidProjectCreator will now exit."); } } }
/** * 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); } }
public void pull(String branch) throws Exception { PullCommand pull = git.pull().setRemote("origin").setRemoteBranchName(branch); if (credentialsProvider != null) pull.setCredentialsProvider(credentialsProvider); pull.call(); }
/** * 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); } }
return git.pull() .setRemote(remote) .setRemoteBranchName(remoteBranch) .setTransportConfigCallback(transport -> { SshTransport sshTransport = (SshTransport) transport;
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; }
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(); } }
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; }
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(); } }
/** * 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); } }
PullCommand pullCommand = git.pull(); setCredentials(pullCommand, username, password); pullCommand.setRemoteBranchName(remoteBranch); PullResult call = pullCommand.call(); if (call.getMergeResult() != null && call.getMergeResult().getConflicts() != null && !call.getMergeResult().getConflicts().isEmpty()) {
public GitManager pullUpdates( final ConflictStrategy strategy ) throws GitSubsystemException { lockAnd( me->{ try { git.pull() .setStrategy( strategy.mergeStrategy() ) .setRemoteBranchName( config.getRemoteBranchName() ) .setRebase( true ) .call(); } catch ( final GitAPIException e ) { throw new GitSubsystemException( "Cannot pull content updates via git: " + e.getMessage(), e ); } return me; } ); return this; }
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(); } }
String remote = getRemoteName(gitConfig.getRepository()); checkoutToSelectedBranch(git); PullResult result = git.pull().setRemote(remote).setRemoteBranchName(branch).setStrategy(MergeStrategy.RESOLVE).call(); if (!result.isSuccessful()) { throw ServerLogger.ROOT_LOGGER.failedToPullRepository(null, gitConfig.getRepository()); config.save(); git.clean(); git.pull().setRemote(remoteName).setRemoteBranchName(branch).setStrategy(MergeStrategy.RESOLVE).call(); checkoutToSelectedBranch(git); if (createGitIgnore(git, basePath)) {
String remote = getRemoteName(gitConfig.getRepository()); checkoutToSelectedBranch(git); PullResult result = git.pull().setRemote(remote).setRemoteBranchName(branch).setStrategy(MergeStrategy.RESOLVE).call(); if (!result.isSuccessful()) { throw ServerLogger.ROOT_LOGGER.failedToPullRepository(null, gitConfig.getRepository()); config.save(); git.clean(); git.pull().setRemote(remoteName).setRemoteBranchName(branch).setStrategy(MergeStrategy.RESOLVE).call(); checkoutToSelectedBranch(git); if (createGitIgnore(git, basePath)) {