Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.CloneCommand.call()


    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


        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

                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

        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

                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

                clone.setCredentialsProvider(credentials);
            }

            if (application.getRepositoryBranch() != null) {
                application.setRepositoryDBBranch(application.getRepositoryBranch());
                clone.call()
                        .checkout()
                        .setCreateBranch(true)
                        .setName(application.getRepositoryBranch())
                        .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK)
                        .setStartPoint(application.getRepositoryBranch()).call();
View Full Code Here

                        .setCreateBranch(true)
                        .setName(application.getRepositoryBranch())
                        .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK)
                        .setStartPoint(application.getRepositoryBranch()).call();
            } else {
                git = clone.call();
            }
        } catch (WrongRepositoryStateException | InvalidConfigurationException | DetachedHeadException |
                InvalidRemoteException | CanceledException | RefNotFoundException | NoHeadException |
                RefAlreadyExistsException | CheckoutConflictException | InvalidRefNameException |
                TransportException e) {
View Full Code Here

        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

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.