Package org.gitective.core

Examples of org.gitective.core.CommitFinder


    RevCommit commit2 = add(Arrays.asList("file1.txt", "file2.txt"),
        Arrays.asList("a1\n", "b\nc\nd\n"));
    RevCommit commit3 = add(Arrays.asList("file1.txt", "file2.txt"),
        Arrays.asList("a1\n", "b\nc\n"));
    CommitListFilter commits = new CommitListFilter();
    new CommitFinder(testRepo).setFilter(
        new AllCommitFilter(new AndCommitFilter(new DiffLineSizeFilter(
            3), commits))).find();
    assertFalse(commits.getCommits().contains(commit1));
    assertTrue(commits.getCommits().contains(commit2));
    assertFalse(commits.getCommits().contains(commit3));
View Full Code Here


        Arrays.asList("file1.txt", "file2.txt"),
        Arrays.asList("a2", "b1"), "commit3");
    CommitListFilter commits = new CommitListFilter();
    DiffFileSizeFilter diffFilter = new DiffFileSizeFilter(2);
    assertEquals(2, diffFilter.getTotal());
    new CommitFinder(testRepo).setFilter(
        new AllCommitFilter(new AndCommitFilter(diffFilter, commits)))
        .find();
    assertTrue(commits.getCommits().contains(commit1));
    assertFalse(commits.getCommits().contains(commit2));
    assertTrue(commits.getCommits().contains(commit3));
View Full Code Here

  @Test
  public void diffMovedFile() throws Exception {
    RevCommit commit1 = add("file.txt", "a\nb\nc");
    RevCommit commit2 = mv("file.txt", "file2.txt");
    CommitListFilter commits = new CommitListFilter();
    new CommitFinder(testRepo).setFilter(
        new AllCommitFilter(new AndCommitFilter(new DiffLineSizeFilter(
            true, 1), commits))).find();
    assertTrue(commits.getCommits().contains(commit1));
    assertFalse(commits.getCommits().contains(commit2));
  }
View Full Code Here

  @Test
  public void noFileExtensions() throws Exception {
    add("file", "content");
    add("file.", "content2");
    ExtensionOccurrenceFilter filter = new ExtensionOccurrenceFilter();
    new CommitFinder(testRepo).setFilter(new CommitTreeFilter(filter))
        .find();
    assertNotNull(filter.getExtensions());
    assertEquals(0, filter.getExtensions().length);
    assertNotNull(filter.getOccurrences());
    assertTrue(filter.getOccurrences().isEmpty());
View Full Code Here

    contents.add("content");
    paths.add("file.txt");
    contents.add("text file");
    add(testRepo, paths, contents, "first commit");
    ExtensionOccurrenceFilter filter = new ExtensionOccurrenceFilter();
    new CommitFinder(testRepo).setFilter(new CommitTreeFilter(filter))
        .find();
    assertEquals(2, filter.getCount("php"));
    assertEquals(1, filter.getCount("txt"));
    ExtensionOccurrence previous = null;
    int count = 0;
View Full Code Here

    contents.add("abcd");
    contents.add("not");
    RevCommit commit = add(testRepo, names, contents, "duplicates");
    DuplicateBlobFilter filter = new DuplicateBlobFilter();
    assertFalse(filter.hasDuplicates());
    new CommitFinder(testRepo).setFilter(filter).find();
    assertTrue(filter.hasDuplicates());
    Map<RevCommit, DuplicateContainer> dupes = filter.getDuplicates();
    assertNotNull(dupes);
    assertTrue(dupes.containsKey(commit));
    DuplicateContainer container = dupes.get(commit);
View Full Code Here

    contents.add("1");
    contents.add("2");
    contents.add("3");
    add(testRepo, names, contents, "duplicates");
    DuplicateBlobFilter filter = new DuplicateBlobFilter();
    new CommitFinder(testRepo).setFilter(filter).find();
    assertFalse(filter.hasDuplicates());
    Map<RevCommit, DuplicateContainer> dupes = filter.getDuplicates();
    assertNotNull(dupes);
    assertTrue(dupes.isEmpty());
  }
View Full Code Here

   */
  @Test
  public void singleAdd() throws Exception {
    add("test.txt", "content");
    DiffFileCountFilter filter = new DiffFileCountFilter();
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, filter.getAdded());
    assertEquals(0, filter.getEdited());
    assertEquals(0, filter.getDeleted());
    assertEquals(0, filter.getRenamed());
    assertEquals(0, filter.getCopied());
View Full Code Here

  @Test
  public void renamedFile() throws Exception {
    add("test.txt", "content");
    mv("test.txt", "test2.txt");
    DiffFileCountFilter filter = new DiffFileCountFilter(true);
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, filter.getAdded());
    assertEquals(0, filter.getEdited());
    assertEquals(0, filter.getDeleted());
    assertEquals(1, filter.getRenamed());
    assertEquals(0, filter.getCopied());
View Full Code Here

  @Test
  public void multipleAdd() throws Exception {
    add("test.txt", "content");
    add("test2.txt", "more content");
    DiffFileCountFilter filter = new DiffFileCountFilter();
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(2, filter.getAdded());
    assertEquals(0, filter.getEdited());
    assertEquals(0, filter.getDeleted());
    assertEquals(0, filter.getRenamed());
    assertEquals(0, filter.getCopied());
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.