Examples of CloneCommand


Examples of org.eclipse.jgit.api.CloneCommand

{
  
   @Override
   public Git clone(final DirectoryResource dir, final String repoUri) throws GitAPIException
   {
      CloneCommand clone = Git.cloneRepository().setURI(repoUri)
               .setDirectory(dir.getUnderlyingResourceObject());
      Git git = clone.call();
      return git;
   }
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

*/
public abstract class GitUtils
{
   public static Git clone(final DirectoryResource dir, final String repoUri) throws GitAPIException
   {
      CloneCommand clone = Git.cloneRepository().setURI(repoUri)
               .setDirectory(dir.getUnderlyingResourceObject());
      Git git = clone.call();
      return git;
   }
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

    // clone the repository
    try {
      Repository canonical = getRepository(repository.name);
      File folder = new File(repositoryManager.getRepositoriesFolder(), cloneName);
      CloneCommand clone = new CloneCommand();
      clone.setBare(true);

      // fetch branches with exclusions
      Collection<Ref> branches = canonical.getRefDatabase().getRefs(Constants.R_HEADS).values();
      List<String> branchesToClone = new ArrayList<String>();
      for (Ref branch : branches) {
        String name = branch.getName();
        if (name.startsWith(Constants.R_TICKET)) {
          // exclude ticket branches
          continue;
        }
        branchesToClone.add(name);
      }
      clone.setBranchesToClone(branchesToClone);
      clone.setURI(fromUrl);
      clone.setDirectory(folder);
      Git git = clone.call();

      // fetch tags
      FetchCommand fetch  = git.fetch();
      fetch.setRefSpecs(new RefSpec("+refs/tags/*:refs/tags/*"));
      fetch.call();
 
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

      File gitDir = FileKey.resolve(new File(repositoriesFolder, name), FS.DETECTED);
      Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
      result.fetchResult = fetchRepository(credentialsProvider, repository);
      repository.close();
    } else {
      CloneCommand clone = new CloneCommand();
      clone.setBare(bare);
      clone.setCloneAllBranches(true);
      clone.setURI(fromUrl);
      clone.setDirectory(folder);
      if (credentialsProvider != null) {
        clone.setCredentialsProvider(credentialsProvider);
      }
      Repository repository = clone.call().getRepository();

      // Now we have to fetch because CloneCommand doesn't fetch
      // refs/notes nor does it allow manual RefSpec.
      result.createdRepository = true;
      result.fetchResult = fetchRepository(credentialsProvider, repository);
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

                try {
                    git = Git.open(workingDir);
                    git.pull().setCredentialsProvider(user).call();
                } catch (Exception e) {
                    workspaceProvider.cleanWorkingDirectory();
                    CloneCommand gitCommand = Git.cloneRepository()
                            .setURI(gitUrl)
                            .setDirectory(workingDir)
                            .setProgressMonitor(new TextProgressMonitor())
                            .setCredentialsProvider(user);
                    git = gitCommand.call();
                }
            } else {
                git = Git.cloneRepository()
                        .setURI(gitUrl)
                        .setDirectory(workingDir)
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

*/
public abstract class GitUtils
{
   public static Git clone(final DirectoryResource dir, final String repoUri) throws IOException
   {
      CloneCommand clone = Git.cloneRepository().setURI(repoUri)
               .setDirectory(dir.getUnderlyingResourceObject());
      Git git = clone.call();
      return git;
   }
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

    // clone the repository
    try {
      Repository canonical = getRepository(repository.name);
      File folder = new File(repositoryManager.getRepositoriesFolder(), cloneName);
      CloneCommand clone = new CloneCommand();
      clone.setBare(true);

      // fetch branches with exclusions
      Collection<Ref> branches = canonical.getRefDatabase().getRefs(Constants.R_HEADS).values();
      List<String> branchesToClone = new ArrayList<String>();
      for (Ref branch : branches) {
        String name = branch.getName();
        if (name.startsWith(Constants.R_TICKET)) {
          // exclude ticket branches
          continue;
        }
        branchesToClone.add(name);
      }
      clone.setBranchesToClone(branchesToClone);
      clone.setURI(fromUrl);
      clone.setDirectory(folder);
      Git git = clone.call();

      // fetch tags
      FetchCommand fetch  = git.fetch();
      fetch.setRefSpecs(new RefSpec("+refs/tags/*:refs/tags/*"));
      fetch.call();
 
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

      File gitDir = FileKey.resolve(new File(repositoriesFolder, name), FS.DETECTED);
      Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
      result.fetchResult = fetchRepository(credentialsProvider, repository);
      repository.close();
    } else {
      CloneCommand clone = new CloneCommand();
      clone.setBare(bare);
      clone.setCloneAllBranches(true);
      clone.setURI(fromUrl);
      clone.setDirectory(folder);
      if (credentialsProvider != null) {
        clone.setCredentialsProvider(credentialsProvider);
      }
      Repository repository = clone.call().getRepository();

      // Now we have to fetch because CloneCommand doesn't fetch
      // refs/notes nor does it allow manual RefSpec.
      result.createdRepository = true;
      result.fetchResult = fetchRepository(credentialsProvider, repository);
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

    GitBlitSuite.close(projectRepo);
    if (projectRepo.exists()) {
      FileUtils.delete(projectRepo, FileUtils.RECURSIVE);
    }

    CloneCommand clone = Git.cloneRepository();
    clone.setURI(MessageFormat.format("{0}/ticgit.git", url));
    clone.setDirectory(createCheck);
    clone.setBare(true);
    clone.setCloneAllBranches(true);
    clone.setCredentialsProvider(cp);
    Git git = clone.call();

    GitBlitSuite.close(personalRepo);

    // add a personal repository remote and a project remote
    git.getRepository().getConfig().setString("remote", "user", "url", MessageFormat.format("{0}/~{1}/ticgit.git", url, user.username));
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

    GitBlitSuite.close(ticgitFolder);
    if (ticgitFolder.exists()) {
      FileUtils.delete(ticgitFolder, FileUtils.RECURSIVE | FileUtils.RETRY);
    }

    CloneCommand clone = Git.cloneRepository();
    clone.setURI(MessageFormat.format("{0}/ticgit.git", url));
    clone.setDirectory(ticgitFolder);
    clone.setBare(false);
    clone.setCloneAllBranches(true);
    clone.setCredentialsProvider(new UsernamePasswordCredentialsProvider(account, password));
    GitBlitSuite.close(clone.call());
    assertTrue(true);
  }
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.