Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Git.fetch()


                checkout.call();
            }
            if (pull) {
                git.pull().call();
            } else {
                git.fetch().call();
            }
        } catch (Exception e) {
            if (!(e.getCause() instanceof TransportException)) {
                throw new RuntimeException(e);
            }
View Full Code Here


            logger.info("Fetching '{}' repository at path: '{}'", context.getName(), context.getProjectPath());

            Git git = new Git(repository);

            FetchResult fetchResult = git.fetch()
                .setProgressMonitor(new LoggingProgressMonitor(logger))
                .call();


            Collection<Ref> refs = FluentIterable
View Full Code Here

  private List<RefSpec> toget;

  @Override
  protected void run() throws Exception {
    Git git = new Git(db);
    FetchCommand fetch = git.fetch();
    if (fsck != null)
      fetch.setCheckFetchedObjects(fsck.booleanValue());
    if (prune != null)
      fetch.setRemoveDeletedRefs(prune.booleanValue());
    if (toget != null)
View Full Code Here

                    gitConfig.setString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME, "url", newOriginUrl);
                    gitConfig.setString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME, "fetch", "+refs/heads/*:refs/remotes/origin/*");
                    gitConfig.save();

                    gitConfig.load();
                    git.fetch().setRemote(Constants.DEFAULT_REMOTE_NAME).call();

                }
            }

            if (!force && gfConfig.gitFlowIsInitialized())
View Full Code Here

                    // This is done because checking out a tag might not happen on the current branch
                    // but create a 'detached HEAD'.
                    // In fact, a tag in git may be in multiple branches. This occurs if
                    // you create a branch after the tag has been created
                    getLogger().debug( "fetch..." );
                    git.fetch().setCredentialsProvider( credentials ).setProgressMonitor( monitor ).call();
                }
                else
                {
                    getLogger().debug( "pull..." );
                    git.pull().setCredentialsProvider( credentials ).setProgressMonitor( monitor ).call();
View Full Code Here

      clone.setURI(fromUrl);
      clone.setDirectory(folder);
      Git git = clone.call();

      // fetch tags
      FetchCommand fetch  = git.fetch();
      fetch.setRefSpecs(new RefSpec("+refs/tags/*:refs/tags/*"));
      fetch.call();

      git.getRepository().close();
    } catch (Exception e) {
View Full Code Here

   * @throws Exception
   */
  public static FetchResult fetchRepository(CredentialsProvider credentialsProvider,
      Repository repository, RefSpec... refSpecs) throws Exception {
    Git git = new Git(repository);
    FetchCommand fetch = git.fetch();
    List<RefSpec> specs = new ArrayList<RefSpec>();
    if (refSpecs == null || refSpecs.length == 0) {
      specs.add(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
      specs.add(new RefSpec("+refs/tags/*:refs/tags/*"));
      specs.add(new RefSpec("+refs/notes/*:refs/notes/*"));
 
View Full Code Here

      clone.setURI(fromUrl);
      clone.setDirectory(folder);
      Git git = clone.call();

      // fetch tags
      FetchCommand fetch  = git.fetch();
      fetch.setRefSpecs(new RefSpec("+refs/tags/*:refs/tags/*"));
      fetch.call();

      git.getRepository().close();
    } catch (Exception e) {
View Full Code Here

   * @throws Exception
   */
  public static FetchResult fetchRepository(CredentialsProvider credentialsProvider,
      Repository repository, RefSpec... refSpecs) throws Exception {
    Git git = new Git(repository);
    FetchCommand fetch = git.fetch();
    List<RefSpec> specs = new ArrayList<RefSpec>();
    if (refSpecs == null || refSpecs.length == 0) {
      specs.add(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
      specs.add(new RefSpec("+refs/tags/*:refs/tags/*"));
      specs.add(new RefSpec("+refs/notes/*:refs/notes/*"));
 
View Full Code Here

        }

        logger.debug("checking {} remote {} for ref updates", repositoryName, mirror.getName());
        final boolean testing = false;
        Git git = new Git(repository);
        FetchResult result = git.fetch().setRemote(mirror.getName()).setDryRun(testing).call();
        Collection<TrackingRefUpdate> refUpdates = result.getTrackingRefUpdates();
        if (refUpdates.size() > 0) {
          ReceiveCommand ticketBranchCmd = null;
          for (TrackingRefUpdate ru : refUpdates) {
            StringBuilder sb = new StringBuilder();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.