Package org.gitective.core

Examples of org.gitective.core.CommitFinder


    add("test.txt", "test2");
    committer = new PersonIdent("a", "a@b.ca");
    RevCommit shortest = add("test.txt", "test3");
    committer = new PersonIdent("a", "a@b.org");
    add("test.txt", "test4");
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(6, filter.getLength());
    assertNotNull(filter.getCommits());
    assertEquals(1, filter.getCommits().size());
    assertEquals(shortest, filter.getCommits().iterator().next());
  }
View Full Code Here


    RevCommit shortest1 = add("test.txt", "test3");
    author = new PersonIdent("a", "a@b.org");
    add("test.txt", "test4");
    author = new PersonIdent("a", "a@b.fr");
    RevCommit shortest2 = add("test.txt", "test5");
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(6, filter.getLength());
    assertNotNull(filter.getCommits());
    assertEquals(2, filter.getCommits().size());
    assertTrue(filter.getCommits().contains(shortest1));
    assertTrue(filter.getCommits().contains(shortest2));
View Full Code Here

    RevCommit shortest1 = add("test.txt", "test3");
    committer = new PersonIdent("a", "a@b.org");
    add("test.txt", "test4");
    committer = new PersonIdent("a", "a@b.fr");
    RevCommit shortest2 = add("test.txt", "test5");
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(6, filter.getLength());
    assertNotNull(filter.getCommits());
    assertEquals(2, filter.getCommits().size());
    assertTrue(filter.getCommits().contains(shortest1));
    assertTrue(filter.getCommits().contains(shortest2));
View Full Code Here

    int commitCount = 50;
    final List<RevCommit> commits = new ArrayList<RevCommit>(commitCount);
    for (int i = 0; i < commitCount; i++)
      commits.add(add("file.txt", "revision " + i));

    CommitFinder service = new CommitFinder(testRepo);
    CommitListFilter bucket = new CommitListFilter();
    CommitLimitFilter limit = new CommitLimitFilter(10);
    limit.setStop(true);

    CommitCursorFilter cursor = new CommitCursorFilter(new AndCommitFilter(
        limit, bucket));
    service.setFilter(cursor);
    int chunks = 0;
    RevCommit commit = CommitUtils.getHead(new FileRepository(testRepo));
    while (commit != null) {
      service.findFrom(commit);
      assertEquals(limit.getLimit(), bucket.getCommits().size());
      commits.removeAll(bucket.getCommits());
      commit = cursor.getLast();
      cursor.reset();
      chunks++;
View Full Code Here

   */
  @Test
  public void zeroDirectories() throws Exception {
    add("f.txt", "content");
    TypeCountFilter filter = TypeCountFilter.tree();
    new CommitFinder(testRepo).setFilter(new CommitTreeFilter(filter))
        .find();
    assertEquals(0, filter.getCount());
  }
View Full Code Here

  @Test
  public void oneDirectory() throws Exception {
    add(testRepo, Arrays.asList("a/b.txt", "a/c.txt"),
        Arrays.asList("f1", "f2"), "commit");
    TypeCountFilter filter = TypeCountFilter.tree();
    new CommitFinder(testRepo).setFilter(new CommitTreeFilter(filter))
        .find();
    assertEquals(1, filter.getCount());
  }
View Full Code Here

  @Test
  public void twoDirectories() throws Exception {
    add(testRepo, Arrays.asList("a/b.txt", "c/d.txt"),
        Arrays.asList("f1", "f2"), "commit");
    TypeCountFilter filter = TypeCountFilter.tree();
    new CommitFinder(testRepo).setFilter(new CommitTreeFilter(filter))
        .find();
    assertEquals(2, filter.getCount());
  }
View Full Code Here

  @Test
  public void nestedDirectories() throws Exception {
    add(testRepo, Arrays.asList("a/b.txt", "a/g/h.txt", "a/u/x.txt"),
        Arrays.asList("f1", "f2", "f3"), "commit");
    TypeCountFilter filter = TypeCountFilter.tree();
    new CommitFinder(testRepo).setFilter(new CommitTreeFilter(filter))
        .find();
    assertEquals(3, filter.getCount());
  }
View Full Code Here

   */
  @Test
  public void resetFilter() throws Exception {
    add("a/b.txt", "content");
    TypeCountFilter filter = TypeCountFilter.tree();
    new CommitFinder(testRepo).setFilter(new CommitTreeFilter(filter))
        .find();
    assertEquals(1, filter.getCount());
    filter.reset();
    assertEquals(0, filter.getCount());
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void matcherThrowsIOException() throws Exception {
    add("test.txt", "content");
    CommitFinder finder = new CommitFinder(testRepo);
    final IOException exception = new IOException("message");
    finder.setFilter(new CommitFilter() {

      public boolean include(RevWalk walker, RevCommit cmit)
          throws IOException {
        throw exception;
      }

      public RevFilter clone() {
        return this;
      }
    });
    try {
      finder.find();
      fail("Exception not thrown by matcher filter");
    } catch (GitException e) {
      assertNotNull(e);
      assertEquals(exception, e.getCause());
    }
View Full Code Here

TOP

Related Classes of org.gitective.core.CommitFinder

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.