Package org.eclipse.egit.core.op

Examples of org.eclipse.egit.core.op.CloneOperation


  protected void clone(final IProgressMonitor monitor, final URIish gitUrl,
      final IPath workDir, int timeout, String refName, boolean exists)
      throws InvocationTargetException, InterruptedException {
    // TODO only clone if not exists
    if (!exists) {
      final CloneOperation cloneOperation = new CloneOperation(gitUrl,
          true, null, workDir.toFile(), refName,
          Constants.DEFAULT_REMOTE_NAME, timeout);
      cloneOperation.run(monitor);
    }
  }
View Full Code Here


    remoteRepositoryFile = createRemoteRepository(repositoryFile);
    // now let's clone the remote repository
    URIish uri = new URIish("file:///" + remoteRepositoryFile.getPath());
    File workdir = new File(getTestDirectory(), "ClonedRepo");

    CloneOperation op = new CloneOperation(uri, true, null, workdir,
        "refs/heads/master", "origin", 0);
    op.run(null);

    clonedRepositoryFile = new File(workdir, Constants.DOT_GIT);

    // now let's clone the remote repository
    uri = new URIish(remoteRepositoryFile.getPath());
    workdir = new File(getTestDirectory(), "ClonedRepo2");

    op = new CloneOperation(uri, true, null, workdir, "refs/heads/master",
        "origin", 0);
    op.run(null);

    clonedRepositoryFile2 = new File(workdir, Constants.DOT_GIT);

    clearView();
    deleteAllProjects();
View Full Code Here

    remoteRepositoryFile = createRemoteRepository(repositoryFile);
    // now let's clone the remote repository
    final URIish uri = new URIish(remoteRepositoryFile.getPath());
    final File workdir = new File(getTestDirectory(), "Cloned");

    CloneOperation op = new CloneOperation(uri, true, null, workdir,
        "refs/heads/master", "origin", 0);
    op.run(null);

    clonedRepositoryFile = new File(workdir, Constants.DOT_GIT);

    RepositoryUtil repositoryUtil = Activator.getDefault()
        .getRepositoryUtil();
View Full Code Here

      return false;
    }

    int timeout = Activator.getDefault().getPreferenceStore()
        .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
    final CloneOperation op = new CloneOperation(uri, allSelected,
        selectedBranches, workdir, ref != null ? ref.getName() : null,
        remoteName, timeout);
    if (credentials != null)
      op.setCredentialsProvider(new EGitCredentialsProvider(
          credentials.getUser(), credentials.getPassword()));
    else
      op.setCredentialsProvider(new EGitCredentialsProvider());
    op.setCloneSubmodules(cloneDestination.isCloneSubmodules());

    configureFetchSpec(op, gitRepositoryInfo, remoteName);
    configurePush(op, gitRepositoryInfo, remoteName);
    configureRepositoryConfig(op, gitRepositoryInfo);

    if (cloneDestination.isImportProjects()) {
      final IWorkingSet[] sets = cloneDestination.getWorkingSets();
      op.addPostCloneTask(new PostCloneTask() {
        public void execute(Repository repository,
            IProgressMonitor monitor) throws CoreException {
          importProjects(repository, sets);
        }
      });
View Full Code Here

  protected File createChildRepository(File repositoryDir)
      throws Exception {
    Repository myRepository = lookupRepository(repositoryDir);
    URIish uri = new URIish("file:///" + myRepository.getDirectory());
    File workdir = new File(testDirectory, CHILDREPO);
    CloneOperation clop = new CloneOperation(uri, true, null, workdir,
        "refs/heads/master", "origin", 0);
    clop.run(null);
    return new File(workdir, Constants.DOT_GIT);
  }
View Full Code Here

                new Object[] { workDir, projectNames, gitUrl }));
      }
    } else {
      try {
        int timeout = 60;
        final CloneOperation cloneOperation = new CloneOperation(
            gitUrl, true, null, workDir.toFile(), refToCheckout,
            Constants.DEFAULT_REMOTE_NAME, timeout);
        cloneOperation.run(monitor);

        return repositoryPath;
      } catch (final InvocationTargetException e) {
        throw getTeamException(e);
      }
View Full Code Here

  }

  private void cloneAndAssert(String refName) throws Exception {
    URIish uri = new URIish("file:///"
        + repository1.getRepository().getDirectory().toString());
    CloneOperation clop = new CloneOperation(uri, true, null, workdir2,
        refName, "origin", 0);
    clop.run(null);

    Repository clonedRepo = FileRepositoryBuilder.create(new File(workdir2,
        Constants.DOT_GIT));
    assertEquals(
        "",
View Full Code Here

  @Test
  public void testSimplePostCloneTask() throws Exception {
    URIish uri = new URIish("file:///"
        + repository1.getRepository().getDirectory().toString());
    CloneOperation clop = new CloneOperation(uri, true, null, workdir2,
        "refs/heads/master", "origin", 0);

    final File[] repoDir = new File[1];
    clop.addPostCloneTask(new PostCloneTask() {

      public void execute(Repository repository, IProgressMonitor monitor)
          throws CoreException {
        repoDir[0] = repository.getDirectory();

      }
    });
    clop.run(null);
    File newRepoDir = new File(workdir2, Constants.DOT_GIT);
    assertEquals(newRepoDir, repoDir[0]);
  }
View Full Code Here

  @Test
  public void testConfigurePushAfterCloneTask() throws Exception {
    URIish uri = new URIish("file:///"
        + repository1.getRepository().getDirectory().toString());
    CloneOperation clop = new CloneOperation(uri, true, null, workdir2,
        "refs/heads/master", "origin", 0);

    clop.addPostCloneTask(new ConfigurePushAfterCloneTask("origin",
        "HEAD:refs/for/master", new URIish("file:///pushtarget")));
    clop.run(null);
    Repository clonedRepo = FileRepositoryBuilder.create(new File(workdir2,
        Constants.DOT_GIT));
    assertEquals(
        "",
        "HEAD:refs/for/master",
View Full Code Here

  public void testConfigureFetchAfterCloneTask() throws Exception {
    createNoteInOrigin();

    URIish uri = new URIish("file:///"
        + repository1.getRepository().getDirectory().toString());
    CloneOperation clop = new CloneOperation(uri, true, null, workdir2,
        "refs/heads/master", "origin", 0);

    clop.addPostCloneTask(new ConfigureFetchAfterCloneTask("origin",
        "refs/notes/review:refs/notes/review"));
    clop.run(null);
    Repository clonedRepo = FileRepositoryBuilder.create(new File(workdir2,
        Constants.DOT_GIT));
    assertTrue(
        clonedRepo.getConfig()
        .getStringList(ConfigConstants.CONFIG_REMOTE_SECTION,
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.op.CloneOperation

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.