Package org.eclipse.egit.core.op

Examples of org.eclipse.egit.core.op.PushOperationSpecification


    config.save();
  }

  private void startPush() throws IOException {
    PushOperationResult result = confirmationPage.getConfirmedResult();
    PushOperationSpecification pushSpec = result
        .deriveSpecification(confirmationPage
            .isRequireUnchangedSelected());

    PushOperationUI pushOperationUI = new PushOperationUI(repository,
        pushSpec, false);
View Full Code Here


    }
  }

  private PushOperation createPushOperation(boolean calledFromRepoPage) {
    try {
      final PushOperationSpecification spec;
      final RemoteConfig config = repoPage.getSelection().getConfig();
      if (calledFromRepoPage) {
        // obtain the push ref specs from the configuration
        // use our own list here, as the config returns a non-modifiable
        // list
        final Collection<RefSpec> pushSpecs = new ArrayList<RefSpec>();
        pushSpecs.addAll(config.getPushRefSpecs());
        final Collection<RemoteRefUpdate> updates = Transport
            .findRemoteRefUpdatesFor(localDb, pushSpecs,
                config.getFetchRefSpecs());
        spec = new PushOperationSpecification();
        for (final URIish uri : repoPage.getSelection().getPushURIs())
          spec.addURIRefUpdates(uri, ConfirmationPage
              .copyUpdates(updates));
      } else if (confirmPage.isConfirmed()) {
        final PushOperationResult confirmedResult = confirmPage
            .getConfirmedResult();
        spec = confirmedResult.deriveSpecification(confirmPage
            .isRequireUnchangedSelected());
      } else {
        final Collection<RefSpec> fetchSpecs;
        if (config != null)
          fetchSpecs = config.getFetchRefSpecs();
        else
          fetchSpecs = null;

        final Collection<RemoteRefUpdate> updates = Transport
            .findRemoteRefUpdatesFor(localDb, refSpecPage
                .getRefSpecs(), fetchSpecs);
        if (updates.isEmpty()) {
          ErrorDialog.openError(getShell(),
              UIText.PushWizard_missingRefsTitle, null,
              new Status(IStatus.ERROR, Activator.getPluginId(),
                  UIText.PushWizard_missingRefsMessage));
          return null;
        }

        spec = new PushOperationSpecification();
        for (final URIish uri : repoPage.getSelection().getPushURIs())
          spec.addURIRefUpdates(uri, ConfirmationPage
              .copyUpdates(updates));
      }
      int timeout = Activator.getDefault().getPreferenceStore().getInt(
          UIPreferences.REMOTE_CONNECTION_TIMEOUT);
      return new PushOperation(localDb, spec, false, timeout);
View Full Code Here

    return specs;
  }

  private void startPush() throws IOException {
    PushOperationResult result = confirmationPage.getConfirmedResult();
    PushOperationSpecification pushSpec = result
        .deriveSpecification(confirmationPage
            .isRequireUnchangedSelected());

    PushOperationUI pushOperationUI = new PushOperationUI(repository,
        pushSpec, false);
View Full Code Here

        setErrorMessage(UIText.ConfirmationPage_errorRefsChangedNoMatch);
        setPageComplete(false);
        return;
      }

      final PushOperationSpecification spec = new PushOperationSpecification();
      for (final URIish uri : displayedRepoSelection.getPushURIs())
        spec.addURIRefUpdates(uri, copyUpdates(updates));
      int timeout = Activator.getDefault().getPreferenceStore().getInt(
          UIPreferences.REMOTE_CONNECTION_TIMEOUT);
      operation = new PushOperation(local, spec, true, timeout);
      if (credentials != null)
        operation.setCredentialsProvider(new UsernamePasswordCredentialsProvider(
View Full Code Here

    if (spec == null) {
      // spec == null => config was supplied in constructor
      // we don't use the configuration directly, as it may contain
      // unsaved changes and as we may need
      // to add the default push RefSpec here
      spec = new PushOperationSpecification();

      List<URIish> urisToPush = new ArrayList<URIish>();
      for (URIish uri : config.getPushURIs())
        urisToPush.add(uri);
      if (urisToPush.isEmpty() && !config.getURIs().isEmpty())
View Full Code Here

      Ref currentHead = repository.getRef(Constants.HEAD);
      RemoteRefUpdate update = new RemoteRefUpdate(repository,
          currentHead, prefixCombo.getItem(prefixCombo
              .getSelectionIndex()) + branchText.getText(),
          false, null, null);
      PushOperationSpecification spec = new PushOperationSpecification();

      spec.addURIRefUpdates(uri, Arrays.asList(update));
      final PushOperationUI op = new PushOperationUI(repository, spec,
          false);
      op.setCredentialsProvider(new EGitCredentialsProvider());
      final PushOperationResult[] result = new PushOperationResult[1];
      getContainer().run(true, true, new IRunnableWithProgress() {
View Full Code Here

  }

  private PushOperation createInvalidPushOperation() throws Exception {
    // set up push with invalid URI to provoke an exception
    PushOperationSpecification spec = new PushOperationSpecification();
    // the remote is invalid
    URIish remote = new URIish(INVALID_URI);
    // update master upon master
    Repository local = repository1.getRepository();
    RemoteRefUpdate update = new RemoteRefUpdate(local, "HEAD", "refs/heads/test",
        false, null, null);
    spec.addURIRefUpdates(remote, Collections.singletonList(update));
    // now we can construct the push operation
    PushOperation pop = new PushOperation(local, spec, false, 0);
    return pop;
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testPushWithReusedSpec() throws Exception {

    PushOperationSpecification spec = new PushOperationSpecification();
    // the remote is repo2
    URIish remote = repository2.getUri();
    // update master upon master
    List<RemoteRefUpdate> refUpdates = new ArrayList<RemoteRefUpdate>();
    RemoteRefUpdate update = new RemoteRefUpdate(repository1
        .getRepository(), "HEAD", "refs/heads/test", false, null, null);
    refUpdates.add(update);
    spec.addURIRefUpdates(remote, refUpdates);

    PushOperation pop = new PushOperation(repository1.getRepository(),
        spec, false, 0);
    pop.run(null);

View Full Code Here

    URIish remote = repository1.getUri();
    String trackingRef = "refs/remotes/origin/master";
    RemoteRefUpdate update = new RemoteRefUpdate(
        repository2.getRepository(), "HEAD", "refs/heads/master", false,
        trackingRef, null);
    PushOperationSpecification spec = new PushOperationSpecification();
    spec.addURIRefUpdates(remote, Arrays.asList(update));

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

  }

  private PushOperation createPushOperation() throws Exception {
    // set up push from repository1 to repository2
    // we cannot re-use the RemoteRefUpdate!!!
    PushOperationSpecification spec = new PushOperationSpecification();
    // the remote is repo2
    URIish remote = new URIish("file:///"
        + repository2.getRepository().getDirectory().toString());
    // update master upon master
    List<RemoteRefUpdate> refUpdates = new ArrayList<RemoteRefUpdate>();
    RemoteRefUpdate update = new RemoteRefUpdate(repository1
        .getRepository(), "HEAD", "refs/heads/test", false, null, null);
    refUpdates.add(update);
    spec.addURIRefUpdates(remote, refUpdates);
    // now we can construct the push operation
    PushOperation pop = new PushOperation(repository1.getRepository(),
        spec, false, 0);
    return pop;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.op.PushOperationSpecification

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.