Package org.gitective.core

Examples of org.gitective.core.CommitFinder


  @Test
  public void nonMatch() throws Exception {
    add("file.txt", "content", "matchmiddlehere");
    CommitMessageFindFilter find = new CommitMessageFindFilter("nomatch");
    CommitCountFilter count = new CommitCountFilter();
    CommitFinder service = new CommitFinder(testRepo);
    service.setFilter(new AndCommitFilter(find, count)).find();
    assertEquals(0, count.getCount());
  }
View Full Code Here


    add("file1.txt", "a");
    add("file2.txt", "b");
    delete("file2.txt");

    CommitListFilter commits = new CommitListFilter();
    new CommitFinder(testRepo).setFilter(
        new AllCommitFilter(new AndCommitFilter(
            new EmptyBlobAddFilter(), commits),
            new AndCommitFilter(new EmptyBlobRemoveFilter(),
                commits))).find();
View Full Code Here

  @Test
  public void add() throws Exception {
    add("file1.txt", "content");
    RevCommit commit = add("file2.txt", "");
    CommitListFilter commits = new CommitListFilter();
    new CommitFinder(testRepo).setFilter(
        new AllCommitFilter(new AndCommitFilter(
            new EmptyBlobAddFilter(), commits))).find();

    assertEquals(1, commits.getCommits().size());
    assertTrue(commits.getCommits().contains(commit));
View Full Code Here

  public void remove() throws Exception {
    add("file1.txt", "content");
    add("file2.txt", "");
    RevCommit commit = delete("file2.txt");
    CommitListFilter commits = new CommitListFilter();
    new CommitFinder(testRepo).setFilter(
        new AllCommitFilter(new AndCommitFilter(
            new EmptyBlobRemoveFilter(), commits))).find();

    assertEquals(1, commits.getCommits().size());
    assertTrue(commits.getCommits().contains(commit));
View Full Code Here

    RevCommit commit2 = add("file2.txt", "b");
    RevCommit commit3 = add("file2.txt", "c");
    add("file3.txt", "d");
    CommitCountFilter all = new CommitCountFilter();
    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

    add("file3.txt", "d");
    add("file3.txt", "e");
    add("file3.txt", "f");

    CommitCountFilter count = new CommitCountFilter();
    CommitFinder finder = new CommitFinder(testRepo);
    finder.setFilter(count);
    finder.setFilter(PathFilterUtils.and("file0.txt"));
    finder.find();
    assertEquals(0, count.getCount());
    finder.setFilter(PathFilterUtils.and("file1.txt"));
    finder.find();
    assertEquals(1, count.getCount());
    count.reset();
    finder.setFilter(PathFilterUtils.and("file2.txt"));
    finder.find();
    assertEquals(2, count.getCount());
    count.reset();
    finder.setFilter(PathFilterUtils.and("file3.txt"));
    finder.find();
    assertEquals(3, count.getCount());
  }
View Full Code Here

    committer = author;
    add("file.txt", "a");
    add("file.txt", "b");
    CommitterDiffFilter filter = new CommitterDiffFilter();
    CommitCountFilter count = new CommitCountFilter();
    new CommitFinder(testRepo)
        .setFilter(new AndCommitFilter(filter, count)).find();
    assertEquals(0, count.getCount());
  }
View Full Code Here

    committer = new PersonIdent("Name" + System.nanoTime(), "Email"
        + System.nanoTime());
    add("file.txt", "b");
    CommitterDiffFilter filter = new CommitterDiffFilter();
    CommitCountFilter count = new CommitCountFilter();
    new CommitFinder(testRepo)
        .setFilter(new AndCommitFilter(filter, count)).find();
    assertEquals(1, count.getCount());
  }
View Full Code Here

  public void match() throws Exception {
    add("file.txt", "abc");
    add("file.txt", "abcd");

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

  @Test
  public void nonMatch() throws Exception {
    add("file.txt", "abc");

    CommitCountFilter count = new CommitCountFilter();
    CommitFinder service = new CommitFinder(testRepo);
    service.setFilter(new AndCommitFilter(new ParentCountFilter(), count));
    service.find();
    assertEquals(0, count.getCount());
  }
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.