Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RemoteConfig


  private FetchResult fetch(Repository clonedRepo, URIish u)
      throws URISyntaxException,
      JGitInternalException,
      InvalidRemoteException, IOException {
    // 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


              return null;
            if (ref.isSymbolic())
              ref = ref.getLeaf();
            name = ref.getName();

            RemoteConfig remoteConfig;
            try {
              remoteConfig = new RemoteConfig(getConfig(),
                  "origin"); //$NON-NLS-1$
            } catch (URISyntaxException e) {
              throw new RevisionSyntaxException(revstr);
            }
            String remoteBranchName = getConfig()
                .getString(
                    ConfigConstants.CONFIG_BRANCH_SECTION,
                Repository.shortenRefName(ref.getName()),
                    ConfigConstants.CONFIG_KEY_MERGE);
            List<RefSpec> fetchRefSpecs = remoteConfig
                .getFetchRefSpecs();
            for (RefSpec refSpec : fetchRefSpecs) {
              if (refSpec.matchSource(remoteBranchName)) {
                RefSpec expandFromSource = refSpec
                    .expandFromSource(remoteBranchName);
View Full Code Here

  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

  protected 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

              return null;
            if (ref.isSymbolic())
              ref = ref.getLeaf();
            name = ref.getName();

            RemoteConfig remoteConfig;
            try {
              remoteConfig = new RemoteConfig(getConfig(),
                  "origin"); //$NON-NLS-1$
            } catch (URISyntaxException e) {
              throw new RevisionSyntaxException(revstr);
            }
            String remoteBranchName = getConfig()
                .getString(
                    ConfigConstants.CONFIG_BRANCH_SECTION,
                Repository.shortenRefName(ref.getName()),
                    ConfigConstants.CONFIG_KEY_MERGE);
            List<RefSpec> fetchRefSpecs = remoteConfig
                .getFetchRefSpecs();
            for (RefSpec refSpec : fetchRefSpecs) {
              if (refSpec.matchSource(remoteBranchName)) {
                RefSpec expandFromSource = refSpec
                    .expandFromSource(remoteBranchName);
View Full Code Here

   *            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

        logger.output("Initialized empty Git repository in " + repo.getWorkDir().getAbsolutePath());
        logger.flushLog();

        // save remote
        final RemoteConfig rc = new RemoteConfig(repo.getConfig(), "origin");
        rc.addURI(uri);
        rc.addFetchRefSpec(new RefSpec().setForceUpdate(true).setSourceDestination(Constants.R_HEADS + "*",
                Constants.R_REMOTES + "origin" + "/*"));
        rc.update(repo.getConfig());
        repo.getConfig().save();
    }
View Full Code Here

TOP

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

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.