Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RefSpec


    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();
View Full Code Here


    return command.call();
  }

  private List<RefSpec> calculateRefSpecs(final String dst) {
    RefSpec wcrs = new RefSpec();
    wcrs = wcrs.setForceUpdate(true);
    wcrs = wcrs.setSourceDestination(Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$
    List<RefSpec> specs = new ArrayList<RefSpec>();
    if (cloneAllBranches)
      specs.add(wcrs);
    else if (branchesToClone != null
        && branchesToClone.size() > 0) {
      for (final String selectedRef : branchesToClone)
        if (wcrs.matchSource(selectedRef))
          specs.add(wcrs.expandFromSource(selectedRef));
    }
    return specs;
  }
View Full Code Here

      transport = Transport.open(repo, remote);
      transport.setOptionUploadPack(uploadPack);
      configure(transport);
      Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1);
      if (tags)
        refSpecs.add(new RefSpec(
            "refs/tags/*:refs/remotes/origin/tags/*"));
      if (heads)
        refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*"));
      Collection<Ref> refs;
      Map<String, Ref> refmap = new HashMap<String, Ref>();
      fc = transport.openFetch();
      refs = fc.getRefs();
      if (refSpecs.isEmpty())
View Full Code Here

        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()));
      }

      if (force) {
        for (int i = 0; i < refSpecs.size(); i++)
          refSpecs.set(i, refSpecs.get(i).setForceUpdate(true));
View Full Code Here

   * @param ref
   *            the source reference. The remote name will match.
   * @return {@code this}.
   */
  public PushCommand add(Ref ref) {
    refSpecs.add(new RefSpec(ref.getLeaf().getName()));
    return this;
  }
View Full Code Here

   * @throws JGitInternalException
   *             the reference name cannot be resolved.
   */
  public PushCommand add(String nameOrSpec) throws JGitInternalException {
    if (0 <= nameOrSpec.indexOf(':')) {
      refSpecs.add(new RefSpec(nameOrSpec));
    } else {
      Ref src;
      try {
        src = repo.getRef(nameOrSpec);
      } catch (IOException e) {
View Full Code Here

   {
      FetchCommand fetch = git.fetch();
      fetch.setCheckFetchedObjects(fsck);
      fetch.setRemoveDeletedRefs(prune);
      if (refSpec != null)
         fetch.setRefSpecs(new RefSpec(refSpec));
      if (timeout >= 0)
         fetch.setTimeout(timeout);
      fetch.setDryRun(dryRun);
      fetch.setRemote(remote);
      fetch.setThin(thin);
View Full Code Here

            IOException
   {
      final FileBasedConfig dstcfg = db.getConfig();
      final RemoteConfig rc = new RemoteConfig(dstcfg, remoteName);
      rc.addURI(uri);
      rc.addFetchRefSpec(new RefSpec().setForceUpdate(true)
               .setSourceDestination(Constants.R_HEADS + "*",
                        Constants.R_REMOTES + remoteName + "/*"));
      rc.update(dstcfg);
      dstcfg.save();
   }
View Full Code Here

   {
      FetchCommand fetch = git.fetch();
      fetch.setCheckFetchedObjects(fsck);
      fetch.setRemoveDeletedRefs(prune);
      if (refSpec != null)
         fetch.setRefSpecs(new RefSpec(refSpec));
      if (timeout >= 0)
         fetch.setTimeout(timeout);
      fetch.setDryRun(dryRun);
      fetch.setRemote(remote);
      fetch.setThin(thin);
View Full Code Here

    RemoteConfig config = new RemoteConfig(repo.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(repo.getConfig());

    repo.getConfig().save();
View Full Code Here

TOP

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

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.