Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.Transport


  public Collection<Ref> call() throws GitAPIException,
      InvalidRemoteException,
      org.eclipse.jgit.api.errors.TransportException {
    checkCallable();

    Transport transport = null;
    FetchConnection fc = null;
    try {
      transport = Transport.open(repo, remote);
      transport.setOptionUploadPack(uploadPack);
      configure(transport);
      Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1);
      if (tags)
        refSpecs.add(new RefSpec(
            "refs/tags/*:refs/remotes/origin/tags/*")); //$NON-NLS-1$
      if (heads)
        refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); //$NON-NLS-1$
      Collection<Ref> refs;
      Map<String, Ref> refmap = new HashMap<String, Ref>();
      fc = transport.openFetch();
      refs = fc.getRefs();
      if (refSpecs.isEmpty())
        for (Ref r : refs)
          refmap.put(r.getName(), r);
      else
        for (Ref r : refs)
          for (RefSpec rs : refSpecs)
            if (rs.matchSource(r)) {
              refmap.put(r.getName(), r);
              break;
            }
      return refmap.values();
    } catch (URISyntaxException e) {
      throw new InvalidRemoteException(MessageFormat.format(
          JGitText.get().invalidRemote, remote));
    } catch (NotSupportedException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
          e);
    } catch (TransportException e) {
      throw new org.eclipse.jgit.api.errors.TransportException(
          e.getMessage(),
          e);
    } finally {
      if (fc != null)
        fc.close();
      if (transport != null)
        transport.close();
    }
  }
View Full Code Here


  public Collection<Ref> call() throws GitAPIException,
      InvalidRemoteException,
      org.eclipse.jgit.api.errors.TransportException {
    checkCallable();

    Transport transport = null;
    FetchConnection fc = null;
    try {
      if (repo != null)
        transport = Transport.open(repo, remote);
      else
        transport = Transport.open(new URIish(remote));
      transport.setOptionUploadPack(uploadPack);
      configure(transport);
      Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1);
      if (tags)
        refSpecs.add(new RefSpec(
            "refs/tags/*:refs/remotes/origin/tags/*")); //$NON-NLS-1$
      if (heads)
        refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); //$NON-NLS-1$
      Collection<Ref> refs;
      Map<String, Ref> refmap = new HashMap<String, Ref>();
      fc = transport.openFetch();
      refs = fc.getRefs();
      if (refSpecs.isEmpty())
        for (Ref r : refs)
          refmap.put(r.getName(), r);
      else
        for (Ref r : refs)
          for (RefSpec rs : refSpecs)
            if (rs.matchSource(r)) {
              refmap.put(r.getName(), r);
              break;
            }
      return refmap.values();
    } catch (URISyntaxException e) {
      throw new InvalidRemoteException(MessageFormat.format(
          JGitText.get().invalidRemote, remote));
    } catch (NotSupportedException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
          e);
    } catch (TransportException e) {
      throw new org.eclipse.jgit.api.errors.TransportException(
          e.getMessage(),
          e);
    } finally {
      if (fc != null)
        fc.close();
      if (transport != null)
        transport.close();
    }
  }
View Full Code Here

  public FetchResult call() throws GitAPIException, InvalidRemoteException,
      org.eclipse.jgit.api.errors.TransportException {
    checkCallable();

    try {
      Transport transport = Transport.open(repo, remote);
      try {
        transport.setCheckFetchedObjects(checkFetchedObjects);
        transport.setRemoveDeletedRefs(removeDeletedRefs);
        transport.setDryRun(dryRun);
        if (tagOption != null)
          transport.setTagOpt(tagOption);
        transport.setFetchThin(thin);
        configure(transport);

        FetchResult result = transport.fetch(monitor, refSpecs);
        return result;
      } finally {
        transport.close();
      }
    } catch (NoRemoteRepositoryException e) {
      throw new InvalidRemoteException(MessageFormat.format(
          JGitText.get().invalidRemote, remote), e);
    } catch (TransportException e) {
View Full Code Here

        repository.setEditable(false);
    }

    private void storeHistory() {
        Transport rc = getRepositoryConnection();
        // TODO: implement history of URLs
        //if(rc != null) {
        //    GitModuleConfig.getDefault().insertRecentUrl(rc);
        //}
    }
View Full Code Here

        public RepositoryStepProgressSupport() {
            super();
        }

        public void perform() {
            final Transport rc = getRepositoryConnection();
            if (rc == null) {
                return;
            }
            String invalidMsg = null;
            HttpURLConnection con = null;
View Full Code Here

        repo.getConfig().save();
    }

    public static FetchResult doFetch(Repository repo, OutputLogger logger) throws NotSupportedException, TransportException, URISyntaxException {
        final FetchResult r;
        final Transport tn = Transport.open(repo, "origin");
        try {
            r = tn.fetch(new GitProgressMonitor(), null);
        } finally {
            tn.close();
        }
        logger.output("--- Fetch Completed ---");
        return r;
    }
View Full Code Here

        private void setItemImpl(Object anObject) {
            assert urlBeingSelectedFromPopup;

            if (anObject instanceof Transport) {
                Transport repoConn = (Transport) anObject;
                repoConnRef = new WeakReference<Transport>(repoConn);
                origEditor.setItem(repoConn.getURI().toString());
            } else {
                clearRepoConnRef();
                origEditor.setItem(anObject);
            }
        }
View Full Code Here

        public Component getEditorComponent() {
            return origEditor.getEditorComponent();
        }
        public Object getItem() {
            Transport repoConn = getRepoConn();
            if (repoConn != null) {
                return repoConn;
            }

            return origEditor.getItem();
View Full Code Here

            clearRepoConnRef();
        }

        private Transport getRepoConn() {
            if (repoConnRef != null) {
                Transport repoConn = repoConnRef.get();
                if (repoConn != null) {
                    return repoConn;
                }
            }
            return null;
View Full Code Here

TOP

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

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.