Package org.gitective.core

Examples of org.gitective.core.CommitFinder


      public boolean include(RevCommit commit, Collection<DiffEntry> diffs) {
        ref.set(diffs);
        throw StopWalkException.INSTANCE;
      }
    };
    new CommitFinder(testRepo).setFilter(filter).find();
    Collection<DiffEntry> diffs = ref.get();
    assertNotNull(diffs);
    assertEquals(1, diffs.size());
    DiffEntry diff = diffs.iterator().next();
    assertEquals(ChangeType.MODIFY, diff.getChangeType());
View Full Code Here


      public boolean include(RevCommit commit, Collection<DiffEntry> diffs) {
        ref.set(diffs);
        throw StopWalkException.INSTANCE;
      }
    };
    new CommitFinder(testRepo).setFilter(filter).find();
    Collection<DiffEntry> diffs = ref.get();
    assertNotNull(diffs);
    assertEquals(1, diffs.size());
    DiffEntry diff = diffs.iterator().next();
    assertEquals(ChangeType.MODIFY, diff.getChangeType());
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void constructors() throws Exception {
    new CommitFinder(testRepo);
    new CommitFinder(new FileRepository(testRepo));
    new CommitFinder(testRepo.getAbsolutePath());
  }
View Full Code Here

    add("repo1file.txt", "content");
    File repo2 = initRepo();
    RevCommit repo2Commit = add(repo2, "repo2file.txt", "test");
    assertEquals(0, repo2Commit.getParentCount());

    CommitFinder service = new CommitFinder(testRepo, repo2);
    CommitCountFilter count = new CommitCountFilter();
    service.setFilter(count).find();
    assertEquals(2, count.getCount());
  }
View Full Code Here

  @Test
  public void cloneFilter() throws Exception {
    add("file1.txt", "a");
    add("file1.txt", "b");
    add("file1.txt", "c");
    CommitFinder service = new CommitFinder(testRepo);
    CommitCountFilter count = new CommitCountFilter();
    CommitLimitFilter limit = new CommitLimitFilter(2);
    service.setFilter(new AndCommitFilter(limit, count)).find();
    assertEquals(2, count.getCount());
    count.reset();
    RevFilter clone = limit.clone();
    assertNotNull(clone);
    assertNotSame(limit, clone);
    service.setFilter(new AndCommitFilter(clone, count)).find();
    assertEquals(2, count.getCount());
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void reset() throws Exception {
    add("file1.txt", "a");
    CommitFinder service = new CommitFinder(testRepo);
    CommitCountFilter count = new CommitCountFilter();
    CommitLimitFilter limit = new CommitLimitFilter(2);
    service.setFilter(new AndCommitFilter(limit, count));
    service.find();
    assertEquals(1, count.getCount());
    service.find();
    assertEquals(2, count.getCount());
    service.find();
    assertEquals(2, count.getCount());
    limit.reset();
    service.find();
    assertEquals(3, count.getCount());
  }
View Full Code Here

  @Test
  public void limit() throws Exception {
    add("file1.txt", "a");
    add("file2.txt", "b");
    add("file3.txt", "c");
    CommitFinder service = new CommitFinder(testRepo);
    CommitCountFilter count = new CommitCountFilter();
    service.setFilter(new AndCommitFilter(new CommitLimitFilter(1), count));
    service.find();
    assertEquals(1, count.getCount());
    count.reset();
    service.setFilter(new AndCommitFilter(new CommitLimitFilter(3), count));
    service.find();
    assertEquals(3, count.getCount());
  }
View Full Code Here

  public void match() throws Exception {
    PersonIdent person = new PersonIdent("Test user", "test@user.com");
    add("file.txt", "patch", Constants.SIGNED_OFF_BY_TAG + person.getName()
        + " <" + person.getEmailAddress() + ">");

    CommitFinder service = new CommitFinder(testRepo);
    CommitCountFilter count = new CommitCountFilter();
    service.setFilter(new AndCommitFilter(new SignedOffByFilter(person),
        count));
    service.find();
    assertEquals(1, count.getCount());

    service.setFilter(new AndCommitFilter(new SignedOffByFilter(person)
        .clone(), count));
    service.find();
    assertEquals(2, count.getCount());
  }
View Full Code Here

  @Test
  public void nonMatch() throws Exception {
    PersonIdent person = new PersonIdent("Test user", "test@user.com");
    add("file.txt", "patch", Constants.SIGNED_OFF_BY_TAG + "person");

    CommitFinder service = new CommitFinder(testRepo);
    CommitCountFilter count = new CommitCountFilter();
    service.setFilter(new AndCommitFilter(new SignedOffByFilter(person),
        count));
    service.find();
    assertEquals(0, count.getCount());
  }
View Full Code Here

    add("test.txt", "test2");
    author = new PersonIdent("a", "a@b.ca");
    RevCommit shortest = add("test.txt", "test3");
    author = 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

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.