Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RefSpec


    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.setOptionUploadPack(uploadPack);

      try {
        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>();
        FetchConnection fc = transport.openFetch();
View Full Code Here

    try {
      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

                String branch = version != null ? version.getName() : null;
                if ( StringUtils.isBlank( branch ) )
                {
                    branch = git.getRepository().getBranch();
                }
                RefSpec refSpec = new RefSpec( Constants.R_HEADS + branch + ":" + Constants.R_HEADS + branch );
                getLogger().info( "push changes to remote... " + refSpec.toString() );
                JGitUtils.push( getLogger(), git, (GitScmProviderRepository) repo, refSpec );
            }

            return new CheckInScmResult( "JGit checkin", checkedInFiles );
        }
View Full Code Here

       
        try
        {
            if (fetch)
            {
                RefSpec spec = new RefSpec("+" + Constants.R_HEADS + gfConfig.getDevelop() + ":" + Constants.R_REMOTES + "origin/" + gfConfig.getDevelop());
                FetchResult result = git.fetch().setRefSpecs(spec).call();
            }

            RevCommit startPoint = null;

            if(null != startCommit)
            {
                startPoint = startCommit;
            }
            else if(!StringUtils.isEmptyOrNull(startCommitString))
            {
                startPoint = GitHelper.getCommitForString(git,startCommitString);
            }
            else
            {
                startPoint = GitHelper.getLatestCommit(git, gfConfig.getDevelop());
            }

            requireCommitOnBranch(startPoint,gfConfig.getDevelop());

            requireTagAbsent(gfConfig.getPrefixValue(JGitFlowConstants.PREFIXES.VERSIONTAG.configKey()) + releaseName);

            if (GitHelper.remoteBranchExists(git, gfConfig.getDevelop()))
            {
                requireLocalBranchNotBehindRemote(gfConfig.getDevelop());
            }

            Ref newBranch = git.checkout()
                      .setName(prefixedReleaseName)
                      .setCreateBranch(true)
                      .setStartPoint(startPoint)
                      .call();

            if (push)
            {
                requireRemoteBranchAbsent(prefixedReleaseName);
                RefSpec branchSpec = new RefSpec(prefixedReleaseName + ":" + Constants.R_HEADS + prefixedReleaseName);
                git.push().setRemote("origin").setRefSpecs(branchSpec).call();
                git.fetch().setRemote("origin").call();

                //setup tracking
                StoredConfig config = git.getRepository().getConfig();
View Full Code Here

        boolean remoteFeatureExists = GitHelper.remoteBranchExists(git,prefixedBranchName);

        //update from remote if needed
        if(remoteFeatureExists && fetchDevelop)
        {
            RefSpec branchSpec = new RefSpec("+" + Constants.R_HEADS + prefixedBranchName + ":" + Constants.R_REMOTES + "origin/" + prefixedBranchName);
            RefSpec developSpec = new RefSpec("+" + Constants.R_HEADS + gfConfig.getDevelop() + ":" + Constants.R_REMOTES + "origin/" + gfConfig.getDevelop());
            git.fetch().setRefSpecs(branchSpec).call();
            git.fetch().setRefSpecs(developSpec).call();
        }
       
        //make sure nothing is behind
View Full Code Here

        git.checkout().setName(gfConfig.getDevelop()).call();
       
        //delete the branch
        if(fetchDevelop)
        {
            RefSpec spec = new RefSpec(":" + Constants.R_HEADS + branch);
            git.push().setRemote("origin").setRefSpecs(spec).call();
        }
       
        if(!keepBranch)
        {
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.