Package org.gitective.core

Examples of org.gitective.core.CommitFinder


    ShortestMessageFilter filter = new ShortestMessageFilter();
    RevCommit shortest = add("test.txt", "test1", "a");
    add("test.txt", "test2", "ab");
    add("test.txt", "test3", "abcd");
    add("test.txt", "test4", "abc");
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, filter.getLength());
    assertNotNull(filter.getCommits());
    assertEquals(1, filter.getCommits().size());
    assertEquals(shortest, filter.getCommits().iterator().next());
  }
View Full Code Here


    add("test.txt", "test1", "abc");
    add("test.txt", "test2", "ab");
    RevCommit shortest1 = add("test.txt", "test3", "a");
    add("test.txt", "test4", "abcde");
    RevCommit shortest2 = add("test.txt", "test5", "b");
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, filter.getLength());
    assertNotNull(filter.getCommits());
    assertEquals(2, filter.getCommits().size());
    assertTrue(filter.getCommits().contains(shortest1));
    assertTrue(filter.getCommits().contains(shortest2));
View Full Code Here

    final String note = "this is a note";
    note(note);

    final AtomicReference<String> found = new AtomicReference<String>();

    CommitFinder finder = new CommitFinder(testRepo);
    finder.setFilter(new NoteContentFilter() {

      protected boolean include(RevCommit commit, Note note,
          String content) {
        found.set(content);
        return super.include(commit, note, content);
      }

    });
    finder.find();
    assertEquals(note, found.get());
  }
View Full Code Here

  public void noteNotIncluded() throws Exception {
    add("test.txt", "abc");
    note("this is a note");

    CommitCountFilter count = new CommitCountFilter();
    CommitFinder finder = new CommitFinder(testRepo);
    finder.setFilter(new AndCommitFilter(new NoteContentFilter() {

      protected boolean include(RevCommit commit, Note note,
          String content) {
        return false;
      }
View Full Code Here

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

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

    add("test.txt", "abc");
    note("a note");
    add("test.txt", "abcd");

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

    note(note1);
    note(note2, "commit2");

    final List<String> notes = new ArrayList<String>();

    CommitFinder finder = new CommitFinder(testRepo);
    finder.setFilter(new NoteContentFilter() {

      protected boolean include(RevCommit commit, Note note,
          String content) {
        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

      public RevFilter clone() {
        return this;
      }
    };
    RevCommit commit = add("file.txt", "content");
    CommitFinder service = new CommitFinder(testRepo);
    service.setFilter(new AllCommitFilter(filter));
    service.find();
    assertEquals(commit, visited.get());
  }
View Full Code Here

      public RevFilter clone() {
        return this;
      }
    };
    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

  @Test
  public void matc() throws Exception {
    add("file.txt", "content", "matchmiddlehere");
    CommitMessageFindFilter find = new CommitMessageFindFilter("middle");
    CommitCountFilter count = new CommitCountFilter();
    CommitFinder service = new CommitFinder(testRepo);
    service.setFilter(new AndCommitFilter(find, count)).find();
    assertEquals(1, 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.