@Override public void pull(String branch, ProgressMonitor monitor) throws GitException { try (Git git = gitOpen()) { PullCommand pullCommand = pullCommand(branch, git); if (monitor != null) { pullCommand.setProgressMonitor(monitor); } else { pullCommand.setProgressMonitor(new DebugProgressMonitor()); } pullCommand.call(); } catch (Throwable e) { throw new GitException("Fail to pull with specific files: " + ExceptionUtil.findRootCause(e).getMessage()); } }
@Override public PullResult pull(final Git git, final int timeout) throws GitAPIException { PullCommand pull = git.pull(); if (timeout >= 0) pull.setTimeout(timeout); pull.setProgressMonitor(new TextProgressMonitor()); PullResult result = pull.call(); return result; }
@Override public Void call() { try { /** git pull is preferable since it's more efficient **/ LOGGER.debug("Started refresh with git pull"); final PullResult result = getGit().pull().setProgressMonitor(PROGRESS_MONITOR).setRebase(true).setCredentialsProvider(user).call(); if (!result.isSuccessful()) { /** if git pull failed, use git reset **/ LOGGER.info("refresh failed. Running undo local changes"); undoLocalChanges(); } LOGGER.debug("Finished refresh"); } catch (final Exception e) { LOGGER.error("Error when refreshing git directory " + workspaceProvider.getRootDirectory(), e); } return null; } });
@Override public Void call() { try { /** git pull is preferable since it's more efficient **/ LOGGER.debug("Started refresh with git pull"); final PullResult result = getGit().pull().setProgressMonitor(PROGRESS_MONITOR).setRebase(true).setCredentialsProvider(user).call(); if (!result.isSuccessful()) { /** if git pull failed, use git reset **/ LOGGER.info("refresh failed. Running undo local changes"); undoLocalChanges(); } LOGGER.debug("Finished refresh"); } catch (final Exception e) { LOGGER.error("Error when refreshing git directory " + workspaceProvider.getRootDirectory(), e); } return null; } });
private Git pullRepository(final File workingDir) throws GitAPIException, IOException { final Git git = Git.open(workingDir); git.pull().setProgressMonitor(PROGRESS_MONITOR) .setRebase(true) .setCredentialsProvider(user) .setTimeout(pullPushTimeoutSeconds) .call(); return git; }
private Git pullRepository(final File workingDir) throws GitAPIException, IOException { final Git git = Git.open(workingDir); git.pull().setProgressMonitor(PROGRESS_MONITOR) .setRebase(true) .setCredentialsProvider(user) .setTimeout(pullPushTimeoutSeconds) .call(); return git; }
@Override public Void call() { try { final PullResult result = gitProctorCore.getGit() .pull() .setProgressMonitor(PROGRESS_MONITOR) .setRebase(true) .setCredentialsProvider(user) .setTimeout(GitProctorUtils.DEFAULT_GIT_PULL_PUSH_TIMEOUT_SECONDS) .call(); if (!result.isSuccessful()) { /** if git pull failed, use git reset **/ gitProctorCore.undoLocalChanges(); } } catch (final Exception e) { LOGGER.error("Error when refreshing git directory " + getDirectoryPath(), e); } return null; } });
@Override public Void call() { try { final PullResult result = gitProctorCore.getGit() .pull() .setProgressMonitor(PROGRESS_MONITOR) .setRebase(true) .setCredentialsProvider(user) .setTimeout(GitProctorUtils.DEFAULT_GIT_PULL_PUSH_TIMEOUT_SECONDS) .call(); if (!result.isSuccessful()) { /** if git pull failed, use git reset **/ gitProctorCore.undoLocalChanges(); } } catch (final Exception e) { LOGGER.error("Error when refreshing git directory " + getDirectoryPath(), e); } return null; } });
git = Git.open(workingDir); final PullResult pullResult = git.pull() .setProgressMonitor(PROGRESS_MONITOR) .setRebase(true) .setCredentialsProvider(user)
git = Git.open(workingDir); final PullResult pullResult = git.pull() .setProgressMonitor(PROGRESS_MONITOR) .setRebase(true) .setCredentialsProvider(user)
private static void cloneSubmodule(Repository repo, ProgressMonitor monitor) throws IOException, GitAPIException { Git git = new Git(repo); git.checkout().setName("master").call(); git.pull().setProgressMonitor(monitor).call(); SubmoduleInitCommand init = new SubmoduleInitCommand(repo); if (init.call().isEmpty()) { return; } SubmoduleUpdateCommand update = new SubmoduleUpdateCommand(repo); update.setProgressMonitor(monitor); if (!update.call().isEmpty()) { SubmoduleWalk walk = SubmoduleWalk.forIndex(repo); while (walk.next()) { Repository subRepo = walk.getRepository(); if (subRepo != null) { try { cloneSubmodule(subRepo,monitor); } finally { subRepo.close(); } } } } }
git.pull().setProgressMonitor(monitor).call();
git.pull().setCredentialsProvider( credentials ).setProgressMonitor( monitor ).call();
.setProgressMonitor(new BasicProgressMonitor()) .setTransportConfigCallback(new SgitTransportCallback()); String username = mRepo.getUsername();
PullCommand command = git.pull().setCredentialsProvider(credentials).setProgressMonitor(monitor); command.setTransportConfigCallback(transportConfigCallback); command.call();
.setProgressMonitor(new BasicProgressMonitor()) .setTransportConfigCallback(new SgitTransportCallback());