Package org.gitective.core

Examples of org.gitective.core.CommitFinder.find()


  public void mostImpacting() throws Exception {
    RevCommit commit1 = add("test.txt", "line1");
    CommitLineImpactFilter filter = new CommitLineImpactFilter(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().last().getAdd());
    filter.reset();
    assertTrue(filter.getCommits().isEmpty());
View Full Code Here


    assertEquals(1, filter.getCommits().last().getAdd());
    filter.reset();
    assertTrue(filter.getCommits().isEmpty());
    RevCommit commit2 = add("test.txt", "line1\nline2\nline3");
    add("test.txt", "line3");
    finder.find();
    assertEquals(1, filter.getCommits().size());
    assertEquals(commit2, filter.getCommits().first().getCommit());
    assertEquals(3, filter.getCommits().last().getEdit());
  }
}
View Full Code Here

    CommitLimitFilter limit = new CommitLimitFilter(2);
    CommitCountFilter count = new CommitCountFilter();
    CommitFinder service = new CommitFinder(testRepo);
    service.setFilter(new AndCommitFilter(new OrCommitFilter().add(limit),
        count));
    service.find();
    assertEquals(2, count.getCount());
  }
}
View Full Code Here

    assertNotNull(clone);
    assertNotSame(parents, clone);

    commits = new CommitListFilter();
    service.setFilter(new AndCommitFilter(clone, commits));
    service.find();
    assertEquals(commit2, commits.getCommits().get(0));
  }
}
View Full Code Here

        found.set(content);
        return super.include(commit, note, content);
      }

    });
    finder.find();
    assertEquals(note, found.get());
  }

  /**
   * Test not including a commit based on the note found
View Full Code Here

        notes.add(content);
        return super.include(commit, note, content);
      }

    });
    finder.find();
    assertEquals(2, notes.size());
    assertTrue(notes.contains(note1));
    assertTrue(notes.contains(note2));
  }
}
View Full Code Here

      }
    };
    RevCommit commit = add("file.txt", "content");
    CommitFinder service = new CommitFinder(testRepo);
    service.setFilter(new AllCommitFilter(filter));
    service.find();
    assertEquals(commit, visited.get());
  }

  /**
   * Test always matching despite children filters not-including
View Full Code Here

      }
    };
    RevCommit commit = add("file.txt", "content");
    CommitFinder service = new CommitFinder(testRepo);
    service.setFilter(new AllCommitFilter(filter1, filter2));
    service.find();
    assertEquals(commit, visited1.get());
    assertEquals(commit, visited2.get());
  }
}
View Full Code Here

    RevCommit commit = add("bar.java", "b");
    LastCommitFilter matcher = new LastCommitFilter();
    CommitFinder finder = new CommitFinder(testRepo);
    finder.setFilter(PathFilterUtils.andSuffix(".java"));
    finder.setFilter(matcher);
    finder.find();
    assertEquals(commit, matcher.getLast());
  }

  /**
   * Test counting some commits that match a path
View Full Code Here

    CommitListFilter path = new CommitListFilter();
    CommitFinder finder = new CommitFinder(testRepo);
    finder.setFilter(new AllCommitFilter(all, new AndCommitFilter(
        new CommitParentTreeFilter(PathFilterUtils.and("file2.txt")),
        path)));
    finder.find();
    assertEquals(4, all.getCount());
    assertEquals(2, path.getCommits().size());
    assertTrue(path.getCommits().contains(commit2));
    assertTrue(path.getCommits().contains(commit3));
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.