command.setStrategy(MergeStrategy.get(strategy.toString()));
private void pull() throws GitAPIException { Lock writeLock = repositoryLock.writeLock(); try { writeLock.lock(); // TODO: Consider changing merge strategy PullCommand pullCommand = git.pull().setStrategy(MergeStrategy.RECURSIVE); if (StringUtils.isNotBlank(login)) { pullCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(login, password)); } PullResult pullResult = pullCommand.call(); if (!pullResult.isSuccessful()) { throw new IllegalStateException("Can't pull: " + pullResult.toString()); } } finally { writeLock.unlock(); } }
@Override public void pull() throws RepositoryException { checkReadyForPushOrPull(); performOperation(getGit().pull() .setStrategy(MergeStrategy.RESOLVE)); }
private Collection<String> attemptRebase() throws GitAPIException { val conflicts = new HashSet<String>(); createStashIfNeeded(); val pr = git.pull().setStrategy(MergeStrategy.RESOLVE).setRebase(true).call(); if (pr.getRebaseResult().getConflicts() != null) { conflicts.addAll(pr.getRebaseResult().getConflicts()); } conflicts.addAll(applyStashIfNeeded()); return conflicts; }
private Git pull(Git git) throws GitAPIException { if (remoteBranchExists(git)) { PullResult result = git.pull().setStrategy(MergeStrategy.RECURSIVE).setCredentialsProvider(this.credentialsProvider()).call(); if (result.isSuccessful()) { return git; } else { log.info("*** pulling git, not able to merge with MergeStrategy.RECURSIVE go for MergeStrategy.THEIRS"); result = git.pull().setStrategy(MergeStrategy.THEIRS).setCredentialsProvider(this.credentialsProvider()).call(); if(result.isSuccessful()){ return git; } throw new GitException("Pull failed: " + result.toString()); } } else { return git; } }
Git pull(Git git) throws GitAPIException { if(remoteBranchExists(git)) { PullResult result = git .pull() .setStrategy(MergeStrategy.THEIRS) .call(); if (result.isSuccessful()) { return git; } else { throw new GitException("Pull failed: " + result.toString()); } } else { return git; } }
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; }
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)) {