Package org.eclipse.jgit.transport

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


        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

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

    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

            Transport transport = Transport.open(localDb, uri);
            transport.setDryRun(dryRun);
            transport.setTimeout(timeout);
            if (credentialsProvider != null)
              transport.setCredentialsProvider(credentialsProvider);
            PushResult result = transport.push(gitSubMonitor, refUpdates, out);

            operationResult.addOperationResult(result.getURI(), result);
            specification.addURIRefUpdates(result.getURI(), result.getRemoteUpdates());
          } catch (JGitInternalException e) {
            String errorMessage = e.getCause() != null ? e
                .getCause().getMessage() : e.getMessage();
            String userMessage = NLS.bind(
                    CoreText.PushOperation_InternalExceptionOccurredMessage,
                    errorMessage);
            handleException(uri, e, userMessage);
          } catch (Exception e) {
            handleException(uri, e, e.getMessage());
          }

          monitor.worked(WORK_UNITS_PER_TRANSPORT);
        } finally {
          // Dirty trick to get things always working.
          subMonitor.beginTask("", WORK_UNITS_PER_TRANSPORT); //$NON-NLS-1$
          subMonitor.done();
          subMonitor.done();
        }
      }
    else {
      final EclipseGitProgressTransformer gitMonitor = new EclipseGitProgressTransformer(
          monitor);
      try {
        Iterable<PushResult> results = git.push().setRemote(
            remoteName).setDryRun(dryRun).setTimeout(timeout)
            .setProgressMonitor(gitMonitor).setCredentialsProvider(
credentialsProvider)
            .setOutputStream(out).call();
        for (PushResult result : results) {
          operationResult.addOperationResult(result.getURI(), result);
        }
      } catch (JGitInternalException e) {
        String errorMessage = e.getCause() != null ? e.getCause()
            .getMessage() : e.getMessage();
        String userMessage = NLS.bind(
View Full Code Here

    PushOperation push = new PushOperation(repository2.getRepository(),
        spec, false, 0);
    push.run(null);

    PushOperationResult result = push.getOperationResult();
    PushResult pushResult = result.getPushResult(remote);
    assertNotNull("Expected result to have tracking ref update", pushResult.getTrackingRefUpdate(trackingRef));

    ObjectId trackingId = repository2.getRepository().resolve(trackingRef);
    assertEquals("Expected tracking branch to be updated", commit.getId(), trackingId);
  }
View Full Code Here

        List<RemoteRefUpdate> acceptedUpdates = new ArrayList<>();
        List<RemoteRefUpdate> rejectedUpdates = new ArrayList<>();
       
        // Collect the updates that are not ok
        while (resit.hasNext()) {
            PushResult pushResult = resit.next();
            pushResults.add(pushResult);
            for (RemoteRefUpdate refUpdate : pushResult.getRemoteUpdates()) {
                Status status = refUpdate.getStatus();
                if (status == Status.OK || status == Status.UP_TO_DATE) {
                    acceptedUpdates.add(refUpdate);
                } else {
                    rejectedUpdates.add(refUpdate);
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.