protected FetchResult fetch(Git git, String label) { FetchCommand fetch = git.fetch(); fetch.setRemote("origin"); fetch.setTagOpt(TagOpt.FETCH_TAGS); fetch.setRemoveDeletedRefs(deleteUntrackedBranches); if (this.refreshRate > 0) { this.setLastRefresh(System.currentTimeMillis()); } configureCommand(fetch); try { FetchResult result = fetch.call(); if (result.getTrackingRefUpdates() != null && result.getTrackingRefUpdates().size() > 0) { logger.info("Fetched for remote " + label + " and found " + result.getTrackingRefUpdates().size() + " updates"); } return result; } catch (Exception ex) { String message = "Could not fetch remote for " + label + " remote: " + git .getRepository().getConfig().getString("remote", "origin", "url"); warn(message, ex); return null; } }
public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { System.out.println("Starting fetch"); try (Git git = new Git(repository)) { FetchResult result = git.fetch().setCheckFetchedObjects(true).call(); System.out.println("Messages: " + result.getMessages()); } } } }
public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { System.out.println("Starting fetch"); try (Git git = new Git(repository)) { FetchResult result = git.fetch().setCheckFetchedObjects(true).call(); System.out.println("Messages: " + result.getMessages()); } } } }
this.git.fetch() .setRemote(REMOTE_NAME) .setCredentialsProvider(getCredentialsProvider())
private void fetch() { FetchCommand fetchCommand = Git.wrap(git).fetch(); try { fetchCommand.setThin(true).call(); } catch (Exception e) { log.error("Failed to perform fetch", e); } }
@Signature public Memory fetch(ArrayMemory settings) throws GitAPIException { FetchCommand command = getWrappedObject().fetch();
FetchResult result = git.fetch().setCheckFetchedObjects(true).call(); System.out.println("Messages: " + result.getMessages());
/** * fetch tags from remote * @param path * @param remoteName * @return * @throws GitException */ public static Path fetchTags(Path path, String remoteName) throws GitException { try (Git git = Git.open(path.toFile())) { git.fetch() .setRemote(remoteName) .setRefSpecs(new RefSpec("refs/tags/*:refs/tags/*")) .setTagOpt(TagOpt.FETCH_TAGS) .call(); } catch (Throwable throwable) { throw new GitException("fetch tags error", throwable); } return path; }
FetchResult result = git.fetch().setCheckFetchedObjects(true).call(); System.out.println("Messages: " + result.getMessages());
fetchCallback.fetchingSubmodule(generator.getPath()); FetchCommand fetchCommand = Git.wrap(repository).fetch(); if (monitor != null) { fetchCommand.setProgressMonitor(monitor);
Repository repository = FileRepositoryBuilder.create(gitDir); Git git = Git.wrap(repository); FetchResult result = git.fetch().call(); for (TrackingRefUpdate refUpdate : result.getTrackingRefUpdates()) { // ... }
Git git = Git.init().setDirectory(new File("fetchtest/test/")).call(); git.fetch().setRemote(new File("../main.git")) .setRefSpecs(new RefSpec("refs/heads/foo:refs/heads/foo")) .call();
private boolean checkMaster() throws GitAPIException { val fr = git.fetch().setDryRun(true).call(); git.close(); return !fr.getTrackingRefUpdates().isEmpty(); }
@Override public FetchCommand fetch() { return configure(super.fetch()).setProgressMonitor(progressMonitor("fetch")); }
@Override public FetchCommand fetch() { return configure(super.fetch()).setProgressMonitor(progressMonitor("fetch")); }
protected void doFetchIfNeeded(JGitFlowExtension fetchingExtension) throws GitAPIException, JGitFlowGitAPIException, JGitFlowExtensionException { if (fetch) { runExtensionCommands(fetchingExtension.beforeFetch()); git.fetch().setRemote(Constants.DEFAULT_REMOTE_NAME).call(); runExtensionCommands(fetchingExtension.afterFetch()); } }
protected void doFetchIfNeeded(JGitFlowExtension fetchingExtension) throws GitAPIException, JGitFlowGitAPIException, JGitFlowExtensionException { if (fetch) { runExtensionCommands(fetchingExtension.beforeFetch()); git.fetch().setRemote(Constants.DEFAULT_REMOTE_NAME).call(); runExtensionCommands(fetchingExtension.afterFetch()); } }
private void gitUpdateFromOrigin() throws GitAPIException { git.fetch().setRemote("origin").call(); git.reset().setMode(ResetCommand.ResetType.HARD).setRef("origin/master").call(); this.contributors = getContributorsFromRepo(); }
public Ref fetchNotesRef(Git git) throws IOException, GitAPIException { Ref ref = git.getRepository().findRef(GIT_NOTES_REF); if (areNotesInRemote(git)) { git.fetch().setRemote("origin") .setDryRun(false) .setRefSpecs(new RefSpec(GIT_NOTES_REF + ":" + GIT_NOTES_REF)) .call(); } return ref; }
private void fetch() throws GitAPIException { for (SubtreeConfig config : subtreeConfigs) { RefSpec branchesSpec = new RefSpec( "refs/heads/*:refs/heads/original/" + config.getRemoteName() + "/*"); RefSpec tagsSpec = new RefSpec("refs/tags/*:refs/tags/original/" + config.getRemoteName() + "/*"); Git git = new Git(repository); git.fetch().setRemote(config.getFetchUri().toPrivateString()) .setRefSpecs(branchesSpec, tagsSpec).call(); } }