Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.SubmoduleAddCommand


    if (repo.isBare()) {
      Project proj = new Project(url, name, revision, null, null);
      proj.copyfiles.addAll(copyfiles);
      bareProjects.add(proj);
    } else {
      SubmoduleAddCommand add = git
        .submoduleAdd()
        .setPath(name)
        .setURI(url);
      if (monitor != null)
        add.setProgressMonitor(monitor);

      try {
        Repository subRepo = add.call();
        if (revision != null) {
          Git sub = new Git(subRepo);
          sub.checkout().setName(findRef(revision, subRepo)).call();
          git.add().addFilepattern(name).call();
        }
View Full Code Here


public class SubmoduleAddTest extends RepositoryTestCase {

  @Test
  public void commandWithNullPath() throws GitAPIException {
    try {
      new SubmoduleAddCommand(db).setURI("uri").call().close();
      fail("Exception not thrown");
    } catch (IllegalArgumentException e) {
      assertEquals(JGitText.get().pathNotConfigured, e.getMessage());
    }
  }
View Full Code Here

  }

  @Test
  public void commandWithEmptyPath() throws GitAPIException {
    try {
      new SubmoduleAddCommand(db).setPath("").setURI("uri").call()
          .close();
      fail("Exception not thrown");
    } catch (IllegalArgumentException e) {
      assertEquals(JGitText.get().pathNotConfigured, e.getMessage());
    }
View Full Code Here

  }

  @Test
  public void commandWithNullUri() throws GitAPIException {
    try {
      new SubmoduleAddCommand(db).setPath("sub").call().close();
      fail("Exception not thrown");
    } catch (IllegalArgumentException e) {
      assertEquals(JGitText.get().uriNotConfigured, e.getMessage());
    }
  }
View Full Code Here

  }

  @Test
  public void commandWithEmptyUri() throws GitAPIException {
    try {
      new SubmoduleAddCommand(db).setPath("sub").setURI("").call()
          .close();
      fail("Exception not thrown");
    } catch (IllegalArgumentException e) {
      assertEquals(JGitText.get().uriNotConfigured, e.getMessage());
    }
View Full Code Here

    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    RevCommit commit = git.commit().setMessage("create file").call();

    SubmoduleAddCommand command = new SubmoduleAddCommand(db);
    String path = "sub";
    command.setPath(path);
    String uri = db.getDirectory().toURI().toString();
    command.setURI(uri);
    Repository repo = command.call();
    assertNotNull(repo);
    addRepoToClose(repo);

    SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
    assertTrue(generator.next());
View Full Code Here

        ent.setObjectId(id);
      }
    });
    editor.commit();

    SubmoduleAddCommand command = new SubmoduleAddCommand(db);
    command.setPath(path);
    command.setURI("git://server/repo.git");
    try {
      command.call().close();
      fail("Exception not thrown");
    } catch (JGitInternalException e) {
      assertEquals(
          MessageFormat.format(JGitText.get().submoduleExists, path),
          e.getMessage());
View Full Code Here

    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    RevCommit commit = git.commit().setMessage("create file").call();

    SubmoduleAddCommand command = new SubmoduleAddCommand(db);
    String path = "sub";
    String uri = "./.git";
    command.setPath(path);
    command.setURI(uri);
    Repository repo = command.call();
    assertNotNull(repo);
    addRepoToClose(repo);

    SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
    assertTrue(generator.next());
View Full Code Here

    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    assertNotNull(git.commit().setMessage("create file").call());

    SubmoduleAddCommand command = new SubmoduleAddCommand(db);
    command.setPath(path2);
    String url2 = db.getDirectory().toURI().toString();
    command.setURI(url2);
    Repository r = command.call();
    assertNotNull(r);
    addRepoToClose(r);

    modulesConfig.load();
    assertEquals(path1, modulesConfig.getString(
View Full Code Here

    assertProjectExistence(PROJ1, true);
    refreshAndWait();
    assertHasRepo(repositoryFile);

    Repository db = lookupRepository(repositoryFile);
    SubmoduleAddCommand command = new SubmoduleAddCommand(db);
    String path = "sub";
    command.setPath(path);
    String uri = db.getDirectory().toURI().toString();
    command.setURI(uri);
    Repository subRepo = command.call();
    assertNotNull(subRepo);
    subRepo.close();

    refreshAndWait();
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.SubmoduleAddCommand

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.