Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.FetchResult


  public Git call() throws GitAPIException, InvalidRemoteException,
      org.eclipse.jgit.api.errors.TransportException {
    try {
      URIish u = new URIish(uri);
      Repository repository = init(u);
      FetchResult result = fetch(repository, u);
      if (!noCheckout)
        checkout(repository, result);
      return new Git(repository);
    } catch (IOException ioe) {
      throw new JGitInternalException(ioe.getMessage(), ioe);
View Full Code Here


          JGitText.get().missingConfigurationForKey, missingKey));
    }

    final boolean isRemote = !remote.equals(".");
    String remoteUri;
    FetchResult fetchRes;
    if (isRemote) {
      remoteUri = repoConfig.getString(
          ConfigConstants.CONFIG_REMOTE_SECTION, remote,
          ConfigConstants.CONFIG_KEY_URL);
      if (remoteUri == null) {
        String missingKey = ConfigConstants.CONFIG_REMOTE_SECTION + DOT
            + remote + DOT + ConfigConstants.CONFIG_KEY_URL;
        throw new InvalidConfigurationException(MessageFormat.format(
            JGitText.get().missingConfigurationForKey, missingKey));
      }

      if (monitor.isCancelled())
        throw new CanceledException(MessageFormat.format(
            JGitText.get().operationCanceled,
            JGitText.get().pullTaskName));

      FetchCommand fetch = new FetchCommand(repo);
      fetch.setRemote(remote);
      fetch.setProgressMonitor(monitor);
      configure(fetch);

      fetchRes = fetch.call();
    } else {
      // we can skip the fetch altogether
      remoteUri = "local repository";
      fetchRes = null;
    }

    monitor.update(1);

    if (monitor.isCancelled())
      throw new CanceledException(MessageFormat.format(
          JGitText.get().operationCanceled,
          JGitText.get().pullTaskName));

    // we check the updates to see which of the updated branches
    // corresponds
    // to the remote branch name
    AnyObjectId commitToMerge;
    if (isRemote) {
      Ref r = null;
      if (fetchRes != null) {
        r = fetchRes.getAdvertisedRef(remoteBranchName);
        if (r == null)
          r = fetchRes.getAdvertisedRef(Constants.R_HEADS
              + remoteBranchName);
      }
      if (r == null)
        throw new JGitInternalException(MessageFormat.format(JGitText
            .get().couldNotGetAdvertisedRef, remoteBranchName));
View Full Code Here

      fetch.setDryRun(dryRun);
      fetch.setRemote(remote);
      fetch.setThin(thin);
      fetch.setProgressMonitor(new TextProgressMonitor());

      FetchResult result = fetch.call();
      return result;
   }
View Full Code Here

   public List<Ref> getRemoteBranches(final Git repo) throws GitAPIException
   {
      List<Ref> results = new ArrayList<>();
      try
      {
         FetchResult fetch = repo.fetch().setRemote("origin").call();
         Collection<Ref> refs = fetch.getAdvertisedRefs();
         for (Ref ref : refs)
         {
            if (ref.getName().startsWith("refs/heads"))
            {
               results.add(ref);
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
                .from(fetchResult.getTrackingRefUpdates())
                .filter(Predicates.not(new Predicate<TrackingRefUpdate>() {
                    @Override
                    public boolean apply(TrackingRefUpdate input) {
                        return NO_CHANGE.equals(input.getResult());
                    }
View Full Code Here

        try
        {
            if (fetch)
            {
                RefSpec spec = new RefSpec("+" + Constants.R_HEADS + gfConfig.getDevelop() + ":" + Constants.R_REMOTES + "origin/" + gfConfig.getDevelop());
                FetchResult result = git.fetch().setRefSpecs(spec).call();
            }

            RevCommit startPoint = null;

            if(null != startCommit)
View Full Code Here

        try
        {
            if (fetch)
            {
                RefSpec spec = new RefSpec("+" + Constants.R_HEADS + gfConfig.getMaster() + ":" + Constants.R_REMOTES + "origin/" + gfConfig.getMaster());
                FetchResult result = git.fetch().setRefSpecs(spec).call();
            }

            requireTagAbsent(gfConfig.getPrefixValue(JGitFlowConstants.PREFIXES.VERSIONTAG.configKey()) + hotfixName);

            if (GitHelper.remoteBranchExists(git, gfConfig.getMaster(), reporter))
View Full Code Here

        if(fetchDevelop)
        {
            RefSpec spec = new RefSpec("+" + Constants.R_HEADS + gfConfig.getDevelop() + ":" + Constants.R_REMOTES + "origin/" + gfConfig.getDevelop());
            try
            {
                FetchResult result = git.fetch().setRefSpecs(spec).call();
            }
            catch (GitAPIException e)
            {
                throw new JGitFlowGitAPIException(e);
            }
View Full Code Here

  public Git call() throws GitAPIException, InvalidRemoteException,
      org.eclipse.jgit.api.errors.TransportException {
    try {
      URIish u = new URIish(uri);
      Repository repository = init(u);
      FetchResult result = fetch(repository, u);
      if (!noCheckout)
        checkout(repository, result);
      return new Git(repository);
    } catch (IOException ioe) {
      throw new JGitInternalException(ioe.getMessage(), ioe);
View Full Code Here

          JGitText.get().missingConfigurationForKey, missingKey));
    }

    final boolean isRemote = !remote.equals(".");
    String remoteUri;
    FetchResult fetchRes;
    if (isRemote) {
      remoteUri = repoConfig.getString(
          ConfigConstants.CONFIG_REMOTE_SECTION, remote,
          ConfigConstants.CONFIG_KEY_URL);
      if (remoteUri == null) {
        String missingKey = ConfigConstants.CONFIG_REMOTE_SECTION + DOT
            + remote + DOT + ConfigConstants.CONFIG_KEY_URL;
        throw new InvalidConfigurationException(MessageFormat.format(
            JGitText.get().missingConfigurationForKey, missingKey));
      }

      if (monitor.isCancelled())
        throw new CanceledException(MessageFormat.format(
            JGitText.get().operationCanceled,
            JGitText.get().pullTaskName));

      FetchCommand fetch = new FetchCommand(repo);
      fetch.setRemote(remote);
      fetch.setProgressMonitor(monitor);
      configure(fetch);

      fetchRes = fetch.call();
    } else {
      // we can skip the fetch altogether
      remoteUri = "local repository";
      fetchRes = null;
    }

    monitor.update(1);

    if (monitor.isCancelled())
      throw new CanceledException(MessageFormat.format(
          JGitText.get().operationCanceled,
          JGitText.get().pullTaskName));

    // we check the updates to see which of the updated branches
    // corresponds
    // to the remote branch name
    AnyObjectId commitToMerge;
    if (isRemote) {
      Ref r = null;
      if (fetchRes != null) {
        r = fetchRes.getAdvertisedRef(remoteBranchName);
        if (r == null)
          r = fetchRes.getAdvertisedRef(Constants.R_HEADS
              + remoteBranchName);
      }
      if (r == null)
        throw new JGitInternalException(MessageFormat.format(JGitText
            .get().couldNotGetAdvertisedRef, remoteBranchName));
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.transport.FetchResult

Copyright © 2018 www.massapicom. 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.