Examples of RemoteConfig


Examples of org.eclipse.jgit.transport.RemoteConfig

   *            merge Ref of the local branch tracking the remote tracking
   *            branch
   * @return full remote tracking branch name or null
   */
  private String findRemoteTrackingBranch(String remote, String mergeRef) {
    RemoteConfig remoteConfig;
    try {
      remoteConfig = new RemoteConfig(config, remote);
    } catch (URISyntaxException e) {
      return null;
    }
    for (RefSpec refSpec : remoteConfig.getFetchRefSpecs()) {
      if (refSpec.matchSource(mergeRef)) {
        RefSpec expanded = refSpec.expandFromSource(mergeRef);
        return expanded.getDestination();
      }
    }
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

  private FetchResult fetch(Repository clonedRepo, URIish u)
      throws URISyntaxException,
      org.eclipse.jgit.api.errors.TransportException, IOException,
      GitAPIException {
    // create the remote config and save it
    RemoteConfig config = new RemoteConfig(clonedRepo.getConfig(), remote);
    config.addURI(u);

    final String dst = (bare ? Constants.R_HEADS : Constants.R_REMOTES
        + config.getName() + "/") + "*"; //$NON-NLS-1$//$NON-NLS-2$
    RefSpec refSpec = new RefSpec();
    refSpec = refSpec.setForceUpdate(true);
    refSpec = refSpec.setSourceDestination(Constants.R_HEADS + "*", dst); //$NON-NLS-1$

    config.addFetchRefSpec(refSpec);
    config.update(clonedRepo.getConfig());

    clonedRepo.getConfig().save();

    // run the fetch command
    FetchCommand command = new FetchCommand(clonedRepo);
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    ArrayList<PushResult> pushResults = new ArrayList<PushResult>(3);

    try {
      if (refSpecs.isEmpty()) {
        RemoteConfig config = new RemoteConfig(repo.getConfig(),
            getRemote());
        refSpecs.addAll(config.getPushRefSpecs());
      }
      if (refSpecs.isEmpty()) {
        Ref head = repo.getRef(Constants.HEAD);
        if (head != null && head.isSymbolic())
          refSpecs.add(new RefSpec(head.getLeaf().getName()));
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

  private FetchResult fetch(Repository clonedRepo, URIish u)
      throws URISyntaxException,
      org.eclipse.jgit.api.errors.TransportException, IOException,
      GitAPIException {
    // create the remote config and save it
    RemoteConfig config = new RemoteConfig(clonedRepo.getConfig(), remote);
    config.addURI(u);

    final String dst = bare ? Constants.R_HEADS : Constants.R_REMOTES
        + config.getName();
    RefSpec refSpec = new RefSpec();
    refSpec = refSpec.setForceUpdate(true);
    refSpec = refSpec.setSourceDestination(Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$

    config.addFetchRefSpec(refSpec);
    config.update(clonedRepo.getConfig());

    clonedRepo.getConfig().save();

    // run the fetch command
    FetchCommand command = new FetchCommand(clonedRepo);
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    String remote = getRemote();
    String mergeRef = getMergeBranch();
    if (remote == null || mergeRef == null)
      return null;

    RemoteConfig remoteConfig;
    try {
      remoteConfig = new RemoteConfig(config, remote);
    } catch (URISyntaxException e) {
      return null;
    }
    for (RefSpec refSpec : remoteConfig.getFetchRefSpecs()) {
      if (refSpec.matchSource(mergeRef)) {
        RefSpec expanded = refSpec.expandFromSource(mergeRef);
        return expanded.getDestination();
      }
    }
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    for (GitSynchronizeData gsd : gsds) {
      String remoteName = gsd.getDstRemoteName();
      if (remoteName == null)
        continue;

      RemoteConfig rc;
      Repository repo = gsd.getRepository();
      StoredConfig config = repo.getConfig();
      try {
        rc = new RemoteConfig(config, remoteName);
      } catch (URISyntaxException e) {
        Activator
            .logError(
                "Unable to create RemoteConfiguration for remote: " + remoteName, e); //$NON-NLS-1$
        continue;
      }

      if (rc.getPushRefSpecs().isEmpty())
        rc.addPushRefSpec(new RefSpec(HEAD + ":" + gsd.getDstMerge())); //$NON-NLS-1$
      PushOperationUI push = new PushOperationUI(repo, rc, false);
      push.setCredentialsProvider(new EGitCredentialsProvider());
      push.start();
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    remoteCombo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN);
    remoteCombo.addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        RemoteConfig remoteConfig = getSelectedRemote();
        remoteSelected(remoteConfig);
      }
    });
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

    int i = 0;
    for (final RemoteConfig rc : remoteConfigs)
      items[i++] = getTextForRemoteConfig(rc);

    remoteCombo.setItems(items);
    RemoteConfig defaultRemoteConfig = getDefaultRemoteConfig();
    setSelectedRemote(defaultRemoteConfig);

    return defaultRemoteConfig;
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

  private void configureNewRemote(URIish uri) throws URISyntaxException,
      IOException {
    StoredConfig config = repository.getConfig();
    String remoteName = getRemoteName();
    RemoteConfig remoteConfig = new RemoteConfig(config, remoteName);
    remoteConfig.addURI(uri);
    RefSpec defaultFetchSpec = new RefSpec().setForceUpdate(true)
        .setSourceDestination(Constants.R_HEADS + "*", //$NON-NLS-1$
            Constants.R_REMOTES + remoteName + "/*"); //$NON-NLS-1$
    remoteConfig.addFetchRefSpec(defaultFetchSpec);
    remoteConfig.update(config);
    config.save();
  }
View Full Code Here

Examples of org.eclipse.jgit.transport.RemoteConfig

   * @throws CoreException
   */
  public void execute(Repository repository, IProgressMonitor monitor)
      throws CoreException {
    try {
      RemoteConfig configToUse = new RemoteConfig(
          repository.getConfig(), remoteName);
      if (pushRefSpec != null)
        configToUse.addPushRefSpec(new RefSpec(pushRefSpec));
      if (pushURI != null)
        configToUse.addPushURI(pushURI);
      configToUse.update(repository.getConfig());
      repository.getConfig().save();
    } catch (Exception e) {
      throw new CoreException(Activator.error(e.getMessage(), e));
    }

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.