Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.ReceivePack


  }

  public void testCreate_Enabled() throws ServiceNotEnabledException,
      ServiceNotAuthorizedException {
    db.getConfig().setBoolean("http", null, "receivepack", true);
    ReceivePack rp;

    rp = factory.create(new R(null, "1.2.3.4"), db);
    assertNotNull("have ReceivePack", rp);
    assertSame(db, rp.getRepository());

    PersonIdent id = rp.getRefLogIdent();
    assertNotNull(id);
    assertEquals("anonymous", id.getName());
    assertEquals("anonymous@1.2.3.4", id.getEmailAddress());

    // Should have inherited off the current system, which is mocked
View Full Code Here


    });
    gs.setReceivePackFactory(new DefaultReceivePackFactory() {
      public ReceivePack create(HttpServletRequest req, Repository db)
          throws ServiceNotEnabledException,
          ServiceNotAuthorizedException {
        ReceivePack rp = super.create(req, db);
        rp.sendError("message line 1");
        rp.sendError("no soup for you!");
        rp.sendError("come back next year!");
        return rp;
      }

    });
    app.addServlet(new ServletHolder(gs), "/*");
 
View Full Code Here

    throw new ServiceNotAuthorizedException();
  }

  private ReceivePack createFor(final HttpServletRequest req,
      final Repository db, final String user) {
    final ReceivePack rp = new ReceivePack(db);
    rp.setRefLogIdent(toPersonIdent(req, user));
    return rp;
  }
View Full Code Here

      return;
    }

    final Repository db = getRepository(req);
    try {
      final ReceivePack rp = receivePackFactory.create(req, db);
      rp.setBiDirectionalPipe(false);
      rsp.setContentType(RSP_TYPE);

      final SmartOutputStream out = new SmartOutputStream(req, rsp);
      rp.receive(getInputStream(req), out, null);
      out.close();

    } catch (ServiceNotAuthorizedException e) {
      rsp.sendError(SC_UNAUTHORIZED);
      return;
View Full Code Here

    @Override
    protected void advertise(HttpServletRequest req, Repository db,
        PacketLineOutRefAdvertiser pck) throws IOException,
        ServiceNotEnabledException, ServiceNotAuthorizedException {
      ReceivePack rp = receivePackFactory.create(req, db);
      try {
        rp.sendAdvertisedRefs(pck);
      } finally {
        rp.getRevWalk().release();
      }
    }
View Full Code Here

    });
    gs.setReceivePackFactory(new DefaultReceivePackFactory() {
      public ReceivePack create(HttpServletRequest req, Repository db)
          throws ServiceNotEnabledException,
          ServiceNotAuthorizedException {
        ReceivePack recv = super.create(req, db);
        recv.setPreReceiveHook(new PreReceiveHook() {
          public void onPreReceive(ReceivePack rp,
              Collection<ReceiveCommand> commands) {
            rp.sendMessage("message line 1");
            rp.sendError("no soup for you!");
            rp.sendMessage("come back next year!");
View Full Code Here

    @Override
    public ReceivePack createReceivePack(String fullRepositoryName) throws IOException, InterruptedException {
        if (isMine(fullRepositoryName)) {
            Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
            ReceivePack rp = repo.createReceivePack(repo.openRepository());
            rp.setPostReceiveHook(new GitPostReceiveHook());
      return rp;
        }
        return null;
    }
View Full Code Here

     * Requires the admin access to be able to push
     */
    @Override
    public ReceivePack createReceivePack(HttpServletRequest context, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException {
        Authentication a = Jenkins.getAuthentication();
        ReceivePack rp = createReceivePack(db);
        rp.setRefLogIdent(new PersonIdent(a.getName(),a.getName()+"@"+context.getRemoteAddr()));
        return rp;
    }
View Full Code Here

        return rp;
    }

    ReceivePack createReceivePack(Repository db) {
        Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
        ReceivePack rp = new ReceivePack(db);
        rp.setPostReceiveHook(new GitPostReceiveHook());
        return rp;
    }
View Full Code Here

            UploadPack uploadPack = new UploadPack(repository);
            uploadPack.setBiDirectionalPipe(false);
            uploadPack.sendAdvertisedRefs(packetLineOutRefAdvertiser);
        } else if (service.equals("git-receive-pack")) {
            Repository repository = GitRepository.buildGitRepository(project, false);
            ReceivePack receivePack = new ReceivePack(repository);
            receivePack.sendAdvertisedRefs(packetLineOutRefAdvertiser);
        }

        byteArrayOutputStream.close();

        return byteArrayOutputStream.toByteArray();
View Full Code Here

TOP

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

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.