Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.PushResult


        final Collection<RemoteRefUpdate> toPush = transport
            .findRemoteRefUpdatesFor(refSpecs);

        try {
          PushResult result = transport.push(monitor, toPush);
          pushResults.add(result);

        } catch (TransportException e) {
          throw new JGitInternalException(
              JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
View Full Code Here


        final Collection<RemoteRefUpdate> toPush = transport
            .findRemoteRefUpdatesFor(refSpecs);

        try {
          PushResult result = transport.push(monitor, toPush);
          pushResults.add(result);

        } catch (TransportException e) {
          throw new JGitInternalException(
              JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
View Full Code Here

        final Collection<RemoteRefUpdate> toPush = transport
            .findRemoteRefUpdatesFor(refSpecs);

        try {
          PushResult result = transport.push(monitor, toPush);
          pushResults.add(result);

        } catch (TransportException e) {
          throw new JGitInternalException(
              JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
View Full Code Here

    RefSpec spec = new RefSpec(branch + ":" + branch);
    Iterable<PushResult> resultIterable = git.push().setRemote(remote)
        .setRefSpecs(spec).call();

    PushResult result = resultIterable.iterator().next();
    TrackingRefUpdate trackingRefUpdate = result
        .getTrackingRefUpdate(trackingBranch);

    assertNotNull(trackingRefUpdate);
    assertEquals(trackingBranch, trackingRefUpdate.getLocalName());
    assertEquals(branch, trackingRefUpdate.getRemoteName());
View Full Code Here

        final Collection<RemoteRefUpdate> toPush = transport
            .findRemoteRefUpdatesFor(refSpecs);

        try {
          PushResult result = transport.push(monitor, toPush, out);
          pushResults.add(result);

        } catch (TransportException e) {
          throw new org.eclipse.jgit.api.errors.TransportException(
              e.getMessage(), e);
View Full Code Here

    final RevBlob Q_txt = src.blob("new text");
    final RevCommit Q = src.commit().add("Q", Q_txt).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;
    PushResult result;

    t = Transport.open(db, remoteURI);
    try {
      final String srcExpr = Q.name();
      final boolean forceUpdate = false;
      final String localName = null;
      final ObjectId oldId = null;

      RemoteRefUpdate update = new RemoteRefUpdate(src.getRepository(),
          srcExpr, dstName, forceUpdate, localName, oldId);
      result = t.push(NullProgressMonitor.INSTANCE, Collections
          .singleton(update));
    } finally {
      t.close();
    }

    assertTrue(remoteRepository.hasObject(Q_txt));
    assertNotNull("has " + dstName, remoteRepository.getRef(dstName));
    assertEquals(Q, remoteRepository.getRef(dstName).getObjectId());
    fsck(remoteRepository, Q);

    List<AccessEvent> requests = getRequests();
    assertEquals(2, requests.size());

    AccessEvent service = requests.get(1);
    assertEquals("POST", service.getMethod());
    assertEquals(join(remoteURI, "git-receive-pack"), service.getPath());
    assertEquals(200, service.getStatus());

    assertEquals("message line 1\n" //
        + "error: no soup for you!\n" //
        + "come back next year!\n", //
        result.getMessages());
  }
View Full Code Here

    final RevBlob Q_txt = src.blob("new text");
    final RevCommit Q = src.commit().add("Q", Q_txt).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;
    PushResult result;

    t = Transport.open(db, remoteURI);
    OutputStream out = new ByteArrayOutputStream();
    try {
      final String srcExpr = Q.name();
      final boolean forceUpdate = false;
      final String localName = null;
      final ObjectId oldId = null;

      RemoteRefUpdate update = new RemoteRefUpdate(src.getRepository(),
          srcExpr, dstName, forceUpdate, localName, oldId);
      result = t.push(NullProgressMonitor.INSTANCE,
          Collections.singleton(update), out);
    } finally {
      t.close();
    }

    String expectedMessage = "message line 1\n" //
        + "error: no soup for you!\n" //
        + "come back next year!\n";
    assertEquals(expectedMessage, //
        result.getMessages());

    assertEquals(expectedMessage, out.toString());
  }
View Full Code Here

        .blob("some blob content to measure pack size");
    final RevCommit Q = src.commit().add("Q", Q_txt).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;
    PushResult result;

    t = Transport.open(db, remoteURI);
    try {
      final String srcExpr = Q.name();
      final boolean forceUpdate = false;
      final String localName = null;
      final ObjectId oldId = null;

      RemoteRefUpdate update = new RemoteRefUpdate(src.getRepository(),
          srcExpr, dstName, forceUpdate, localName, oldId);
      result = t.push(NullProgressMonitor.INSTANCE,
          Collections.singleton(update));
    } finally {
      t.close();
    }
    assertEquals("expected 1 RemoteUpdate", 1, result.getRemoteUpdates()
        .size());
    assertEquals("unexpected pack size", 1398, packSize);
  }
View Full Code Here

      pushCommand.setForce(force);
      Iterable<PushResult> resultIterable = pushCommand.call();
      if (monitor.isCanceled()) {
        return new Status(IStatus.CANCEL, GitActivator.PI_GIT, "Cancelled");
      }
      PushResult pushResult = resultIterable.iterator().next();
      boolean error = false;
      JSONArray updates = new JSONArray();
      result.put(GitConstants.KEY_COMMIT_MESSAGE, pushResult.getMessages());
      result.put(GitConstants.KEY_UPDATES, updates);
      for (final RemoteRefUpdate rru : pushResult.getRemoteUpdates()) {
        if (monitor.isCanceled()) {
          return new Status(IStatus.CANCEL, GitActivator.PI_GIT, "Cancelled");
        }
        final String rm = rru.getRemoteName();
        // check status only for branch given in the URL or tags
View Full Code Here

    final RevBlob Q_txt = src.blob("new text");
    final RevCommit Q = src.commit().add("Q", Q_txt).create();
    final Repository db = src.getRepository();
    final String dstName = Constants.R_HEADS + "new.branch";
    Transport t;
    PushResult result;

    t = Transport.open(db, remoteURI);
    try {
      final String srcExpr = Q.name();
      final boolean forceUpdate = false;
      final String localName = null;
      final ObjectId oldId = null;

      RemoteRefUpdate update = new RemoteRefUpdate(src.getRepository(),
          srcExpr, dstName, forceUpdate, localName, oldId);
      result = t.push(NullProgressMonitor.INSTANCE, Collections
          .singleton(update));
    } finally {
      t.close();
    }

    assertTrue(remoteRepository.hasObject(Q_txt));
    assertNotNull("has " + dstName, remoteRepository.getRef(dstName));
    assertEquals(Q, remoteRepository.getRef(dstName).getObjectId());
    fsck(remoteRepository, Q);

    List<AccessEvent> requests = getRequests();
    assertEquals(2, requests.size());

    AccessEvent service = requests.get(1);
    assertEquals("POST", service.getMethod());
    assertEquals(join(remoteURI, "git-receive-pack"), service.getPath());
    assertEquals(200, service.getStatus());

    assertEquals("message line 1\n" //
        + "error: no soup for you!\n" //
        + "come back next year!\n", //
        result.getMessages());
  }
View Full Code Here

TOP

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

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.