Examples of FetchConnection


Examples of org.eclipse.jgit.transport.FetchConnection

  @Test
  public void testListRemoteWithoutLocalRepository() throws Exception {
    Transport t = Transport.open(smartAuthNoneURI);
    try {
      FetchConnection c = t.openFetch();
      try {
        Ref head = c.getRef(Constants.HEAD);
        assertNotNull(head);
      } 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

      // --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

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() + "^{}");
      }
    } finally {
      c.close();
      tn.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

      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/*"));
      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(
          e.getMessage(),
          e);
    } finally {
      if (fc != null)
        fc.close();
      if (transport != null)
        transport.close();
    }
  }
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.