Examples of FetchConnection


Examples of org.eclipse.jgit.transport.FetchConnection

  public Collection<Ref> call() throws GitAPIException,
      JGitInternalException {
    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/*"));
      if (heads)
        refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*"));
      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(
          JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
          e);
    } finally {
      if (fc != null)
        fc.close();
      if (transport != null)
        transport.close();
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchConnection

          refSpecs.add(new RefSpec(
              "refs/heads/*:refs/remotes/origin/*"));
        }
        Collection<Ref> refs;
        Map<String, Ref> refmap = new HashMap<String, Ref>();
        FetchConnection fc = transport.openFetch();
        try {
          refs = fc.getRefs();
          for (Ref r : refs) {
            boolean found = refSpecs.isEmpty();
            for (RefSpec rs : refSpecs) {
              if (rs.matchSource(r)) {
                found = true;
                break;
              }
            }
            if (found) {
              refmap.put(r.getName(), r);
            }

          }
        } finally {
          fc.close();
        }
        return refmap.values();

      } catch (TransportException e) {
        throw new JGitInternalException(
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchConnection

  @Override
  protected void run() throws Exception {
    final Transport tn = Transport.open(db, remote);
    if (0 <= timeout)
      tn.setTimeout(timeout);
    final FetchConnection c = tn.openFetch();
    try {
      for (final Ref r : c.getRefs()) {
        show(r.getObjectId(), r.getName());
        if (r.getPeeledObjectId() != null)
          show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$
      }
    } finally {
      c.close();
      tn.close();
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchConnection

  @Override
  protected void run() throws Exception {
    final Transport tn = Transport.open(db, remote);
    if (0 <= timeout)
      tn.setTimeout(timeout);
    final FetchConnection c = tn.openFetch();
    try {
      for (final Ref r : c.getRefs()) {
        show(r.getObjectId(), r.getName());
        if (r.getPeeledObjectId() != null)
          show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$
      }
    } finally {
      c.close();
      tn.close();
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchConnection

      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;
    } 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

Examples of org.eclipse.jgit.transport.FetchConnection

      // --spearce
      //
      assertTrue("isa TransportHttp", t instanceof TransportHttp);
      assertTrue("isa HttpTransport", t instanceof HttpTransport);

      FetchConnection c = t.openFetch();
      try {
        map = c.getRefsMap();
      } finally {
        c.close();
      }
    } finally {
      t.close();
    }
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchConnection

      // --spearce
      //
      assertTrue("isa TransportHttp", t instanceof TransportHttp);
      assertTrue("isa HttpTransport", t instanceof HttpTransport);

      FetchConnection c = t.openFetch();
      try {
        map = c.getRefsMap();
      } finally {
        c.close();
      }
    } finally {
      t.close();
    }
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchConnection

    Repository dst = createBareRepository();
    Ref head;
    Transport t = Transport.open(dst, dumbAuthNoneURI);
    try {
      FetchConnection c = t.openFetch();
      try {
        head = c.getRef(Constants.HEAD);
      } finally {
        c.close();
      }
    } finally {
      t.close();
    }
    assertNotNull("has " + Constants.HEAD, head);
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchConnection

    Repository dst = createBareRepository();
    Ref head;
    Transport t = Transport.open(dst, dumbAuthNoneURI);
    try {
      FetchConnection c = t.openFetch();
      try {
        head = c.getRef(Constants.HEAD);
      } finally {
        c.close();
      }
    } finally {
      t.close();
    }
    assertNull("has no " + Constants.HEAD, head);
View Full Code Here

Examples of org.eclipse.jgit.transport.FetchConnection

    Repository dst = createBareRepository();
    Ref head;
    Transport t = Transport.open(dst, smartAuthNoneURI);
    try {
      FetchConnection c = t.openFetch();
      try {
        head = c.getRef(Constants.HEAD);
      } finally {
        c.close();
      }
    } finally {
      t.close();
    }
    assertNotNull("has " + Constants.HEAD, head);
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.