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

        monitor);
    Repository repository = null;
    try {
      monitor.beginTask(NLS.bind(CoreText.CloneOperation_title, uri),
          5000);
      CloneCommand cloneRepository = Git.cloneRepository();
      cloneRepository.setCredentialsProvider(credentialsProvider);
      if (refName != null)
        cloneRepository.setBranch(refName);
      else
        cloneRepository.setNoCheckout(true);
      cloneRepository.setDirectory(workdir);
      cloneRepository.setProgressMonitor(gitMonitor);
      cloneRepository.setRemote(remoteName);
      cloneRepository.setURI(uri.toString());
      cloneRepository.setTimeout(timeout);
      cloneRepository.setCloneAllBranches(allSelected);
      cloneRepository.setCloneSubmodules(cloneSubmodules);
      if (selectedBranches != null) {
        List<String> branches = new ArrayList<String>();
        for (Ref branch : selectedBranches)
          branches.add(branch.getName());
        cloneRepository.setBranchesToClone(branches);
      }
      Git git = cloneRepository.call();
      repository = git.getRepository();
      synchronized (this) {
        if (postCloneTasks != null)
          for (PostCloneTask task : postCloneTasks)
            task.execute(git.getRepository(), monitor);
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

    @Test
    @Issue("JENKINS-25632")
    public void initialRepoShouldBeEmpty() throws Exception {
        // initial clone
        CloneCommand clone = Git.cloneRepository();
        clone.setURI(new URL(j.getURL(), "workflowLibs.git").toExternalForm());
        File dir = tmp.newFolder();
        clone.setDirectory(dir);
        Git git = clone.call();

        // makes sure there's nothing in here
        Collection<Ref> remotes = git.lsRemote().setRemote("origin").call();
        assertEquals(0,remotes.size());
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

  @Override
  public void execute() throws BuildException {
    log("Cloning repository " + uri);
   
    CloneCommand clone = Git.cloneRepository();
    try {
      clone.setURI(uri).setDirectory(destination).setBranch(branch).setBare(bare);
      clone.call();
    } catch (Exception e) {
      log("Could not clone repository: " + e, e, Project.MSG_ERR);
      throw new BuildException("Could not clone repository: " + e.getMessage(), e);
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

            throw new IOException("Failed to create local repository");
        }
        File gitDir = new File(localRepo, ".git");
        if (!gitDir.exists()) {
            LOG.info("Cloning remote repo " + repo);
            CloneCommand command = Git.cloneRepository().setCredentialsProvider(credentials).
                    setURI(repo).setDirectory(localRepo).setRemote(remoteName);
            git = command.call();
        } else {
            FileRepositoryBuilder builder = new FileRepositoryBuilder();
            Repository repository = builder.setGitDir(gitDir)
                    .readEnvironment() // scan environment GIT_* variables
                    .findGitDir() // scan up the file system tree
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

        File gitDir = new File(buildDir, ".git");
        if (!gitDir.exists()) {
            String repo = gitUrl;
            if (Strings.isNotBlank(repo)) {
                getLog().info("Cloning git repo " + repo + " into directory " + getGitBuildPathDescription() + " cloneAllBranches: " + cloneAll);
                CloneCommand command = Git.cloneRepository().
                        setCloneAllBranches(cloneAll).setURI(repo).setDirectory(buildDir).setRemote(remoteName);
                // .setCredentialsProvider(getCredentials()).
                try {
                    git = command.call();
                    return;
                } catch (Throwable e) {
                    getLog().error("Failed to command remote repo " + repo + " due: " + e.getMessage(), e);
                    // lets just use an empty repo instead
                }
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

        if (log.isLoggable(Level.FINE)) {
            log.fine("Preparing to clone " + configuration.getRemoteRepositoryUri() + " to " + repository.getAbsolutePath());
        }

        CloneCommand cloneCmd = Git.cloneRepository();
        cloneCmd.setDirectory(repository).setURI(configuration.getRemoteRepositoryUri());
        cloneCmd.setCredentialsProvider(credentialsProvider);

        this.git = new GitUtil(cloneCmd.call());
        this.markingUtil = new MarkingUtil(git);

        if (log.isLoggable(Level.FINE)) {
            log.fine("Cloned remote repository from " + configuration.getRemoteRepositoryUri() + " to "
                    + repository.getAbsolutePath());
View Full Code Here

Examples of org.eclipse.jgit.api.CloneCommand

        if (!gitDir.exists()) {
            String repo = getRemoteRepository();
            if (Strings.isNotBlank(repo) && isCloneRemoteRepoOnStartup()) {
                boolean cloneAll = isCloneAllBranches();
                LOG.info("Cloning git repo " + repo + " into directory " + confDir.getCanonicalPath() + " cloneAllBranches: " + cloneAll);
                CloneCommand command = Git.cloneRepository().setCredentialsProvider(getCredentials()).
                        setCloneAllBranches(cloneAll).setURI(repo).setDirectory(confDir).setRemote(remote);
                try {
                    git = command.call();
                    return;
                } catch (Throwable e) {
                    LOG.error("Failed to command remote repo " + repo + " due: " + e.getMessage(), e);
                    // lets just use an empty repo instead
                }
View Full Code Here

Examples of org.hivedb.teamcity.plugin.commands.CloneCommand

  public String getCurrentVersion(VcsRoot root) throws VcsException {
    log.warn("Getting current version");
   
    GitConfiguration configuration = GitConfiguration.createServerConfiguration(root);
    if (!configuration.isProjectDirectoryARepository()) {
      new CloneCommand(configuration).run(false);
    }
    else {
      new FetchCommand(configuration).run();
    }
    LogCommand getLog = new LogCommand(configuration);
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.