Package org.gitective.core

Examples of org.gitective.core.CommitFinder


  @Test
  public void mostImpacting() throws Exception {
    RevCommit commit1 = add("test1.txt", "content2");
    CommitFileImpactFilter filter = new CommitFileImpactFilter(1);
    assertEquals(1, filter.getLimit());
    CommitFinder finder = new CommitFinder(testRepo).setFilter(filter);
    finder.find();
    assertEquals(1, filter.getCommits().size());
    assertEquals(commit1, filter.getCommits().first().getCommit());
    assertEquals(1, filter.getCommits().first().getAdd());
    filter.reset();
    assertTrue(filter.getCommits().isEmpty());
    RevCommit commit2 = add(testRepo,
        Arrays.asList("test2.txt", "test3.txt"),
        Arrays.asList("content2", "content3"), "second commit");
    add("test1.txt", "new content");
    delete("test3.txt");
    finder.find();
    assertEquals(1, filter.getCommits().size());
    assertEquals(commit2, filter.getCommits().first().getCommit());
    assertEquals(2, filter.getCommits().first().getAdd());
  }
View Full Code Here


  public void match() throws Exception {
    add("file.txt", "content", "fixes NPE\nBug: 1234");

    CommitCountFilter count = new CommitCountFilter();

    new CommitFinder(testRepo).setFilter(
        new AndCommitFilter().add(new BugFilter(), count)).find();

    assertEquals(1, count.getCount());
  }
View Full Code Here

  public void nonMatch() throws Exception {
    add("file.txt", "content", "fixes NPE\nIssue: 1234");

    CommitCountFilter count = new CommitCountFilter();

    new CommitFinder(testRepo).setFilter(
        new AndCommitFilter(new BugFilter(), count)).find();

    assertEquals(0, count.getCount());
  }
View Full Code Here

  public void multipleCommits() throws Exception {
    add("file.txt", "content", "fixes NPE\nBug: 1");
    add("file.txt2", "content", "fixes NPE\nBug: a");

    BugSetFilter bugs = new BugSetFilter();
    new CommitFinder(testRepo).setFilter(bugs).find();

    assertEquals(2, bugs.getBugs().size());
    assertTrue(bugs.getBugs().contains("1"));
    assertTrue(bugs.getBugs().contains("a"));
  }
View Full Code Here

  @Test
  public void multipleBugsSameCommit() throws Exception {
    add("file.txt", "content", "fixes NPE\nBug: 123\nBug: 456");

    BugSetFilter bugs = new BugSetFilter();
    new CommitFinder(testRepo).setFilter(bugs).find();

    assertEquals(2, bugs.getBugs().size());
    assertTrue(bugs.getBugs().contains("123"));
    assertTrue(bugs.getBugs().contains("456"));
  }
View Full Code Here

    CommitCountFilter count = new CommitCountFilter();
    BugFilter filter = new BugFilter();
    RevFilter clone = filter.clone();
    assertNotNull(clone);
    assertNotSame(filter, clone);
    new CommitFinder(testRepo).setFilter(
        new AndCommitFilter(filter, clone, count)).find();

    assertEquals(1, count.getCount());
  }
View Full Code Here

    BugSetFilter filter = new BugSetFilter();
    BugSetFilter clone = (BugSetFilter) filter.clone();
    assertNotNull(clone);
    assertNotSame(filter, clone);
    new CommitFinder(testRepo)
        .setFilter(new AndCommitFilter(filter, clone)).find();

    assertEquals(1, filter.getBugs().size());
    assertEquals(1, clone.getBugs().size());
    assertEquals("abcd", filter.getBugs().iterator().next());
View Full Code Here

  public void reset() throws Exception {
    add("file.txt", "content", "fixes NPE\nBug: abcd");

    BugSetFilter filter = new BugSetFilter();
    assertEquals(0, filter.getBugs().size());
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, filter.getBugs().size());
    filter.reset();
    assertEquals(0, filter.getBugs().size());
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, filter.getBugs().size());
  }
View Full Code Here

    committer = findUser;
    RevCommit commit1 = add("file.txt", "b");
    RevCommit commit2 = add("file.txt", "c");
    CommitterFilter filter = new CommitterFilter(findUser);
    CommitListFilter commits = new CommitListFilter();
    CommitFinder service = new CommitFinder(testRepo);
    service.setFilter(new AndCommitFilter(filter, commits));
    service.find();
    assertEquals(2, commits.getCommits().size());
    assertEquals(commit2, commits.getCommits().get(0));
    assertEquals(commit1, commits.getCommits().get(1));
  }
View Full Code Here

  public void lineDiffSingleFile() throws Exception {
    RevCommit commit1 = add("file.txt", "a\nb\nc");
    RevCommit commit2 = add("file.txt", "a\nb2\nc");
    RevCommit commit3 = add("file.txt", "");
    CommitListFilter commits = new CommitListFilter();
    new CommitFinder(testRepo).setFilter(
        new AllCommitFilter(new AndCommitFilter(new DiffLineSizeFilter(
            3), commits))).find();
    assertTrue(commits.getCommits().contains(commit1));
    assertFalse(commits.getCommits().contains(commit2));
    assertTrue(commits.getCommits().contains(commit3));
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.