Examples of PushResult


Examples of org.eclipse.jgit.transport.PushResult

        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

Examples of org.eclipse.jgit.transport.PushResult

    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

Examples of org.eclipse.jgit.transport.PushResult

    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

Examples of org.eclipse.jgit.transport.PushResult

        .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

Examples of org.eclipse.jgit.transport.PushResult

      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

Examples of org.eclipse.jgit.transport.PushResult

    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

Examples of org.eclipse.jgit.transport.PushResult

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

      final URIish uri = transport.getURI();
      final PushResult result;
      try {
        result = transport.push(new TextProgressMonitor(), toPush);
      } finally {
        transport.close();
      }
View Full Code Here

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 org.eclipse.jgit.api.errors.TransportException(
              e.getMessage(), e);
View Full Code Here

Examples of org.eclipse.jgit.transport.PushResult

   */
  public PushOperationSpecification deriveSpecification(
      final boolean requireUnchanged) throws IOException {
    final PushOperationSpecification spec = new PushOperationSpecification();
    for (final URIish uri : getURIs()) {
      final PushResult pr = getPushResult(uri);
      if (pr == null)
        continue;

      final Collection<RemoteRefUpdate> oldUpdates = pr
          .getRemoteUpdates();
      final ArrayList<RemoteRefUpdate> newUpdates = new ArrayList<RemoteRefUpdate>(
          oldUpdates.size());
      for (final RemoteRefUpdate rru : oldUpdates) {
        final ObjectId expectedOldObjectId;
View Full Code Here

Examples of org.eclipse.jgit.transport.PushResult

    for (final URIish uri : getURIs()) {
      if (!isSuccessfulConnection(uri))
        continue;

      final PushResult otherPushResult = other.getPushResult(uri);
      for (final RemoteRefUpdate rru : getPushResult(uri)
          .getRemoteUpdates()) {
        final RemoteRefUpdate otherRru = otherPushResult
            .getRemoteUpdate(rru.getRemoteName());
        if (otherRru == null)
          return false;
        if (otherRru.getStatus() != rru.getStatus()
            || otherRru.getNewObjectId() != rru.getNewObjectId())
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.