Package org.gitective.core

Examples of org.gitective.core.CommitFinder


  public void cloneFilter() throws Exception {
    add("file.txt", "abc");
    RevCommit commit2 = add("file.txt", "abcd");

    CommitListFilter commits = new CommitListFilter();
    CommitFinder service = new CommitFinder(testRepo);
    ParentCountFilter parents = new ParentCountFilter(1);
    service.setFilter(new AndCommitFilter(parents, commits));
    service.find();
    assertEquals(commit2, commits.getCommits().get(0));

    RevFilter clone = parents.clone();
    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


    CommitListFilter javaBugCommits = new CommitListFilter();
    AndCommitFilter javaBugFilters = new AndCommitFilter(
        new CommitParentTreeFilter(PathFilterUtils.andSuffix(".java")),
        javaBugCommits);

    CommitFinder finder = new CommitFinder(testRepo);
    finder.setFilter(new AllCommitFilter(bugFilters, javaBugFilters));
    finder.find();
    assertEquals(2, javaBugCommits.getCommits().size());
    assertTrue(javaBugCommits.getCommits().contains(commit4));
    assertTrue(javaBugCommits.getCommits().contains(commit5));
    assertEquals(4, bugCommits.getCommits().size());
    assertTrue(bugCommits.getCommits().contains(commit2));
View Full Code Here

  @Test
  public void singleSuffix() throws Exception {
    add("foo.cpp", "a");
    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());
  }
View Full Code Here

  @Test
  public void twoSuffixes() throws Exception {
    add("foo.cpp", "a");
    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());
  }
View Full Code Here

        blob.set(diffs.iterator().next().getNewId());
        return true;
      }

    };
    new CommitFinder(testRepo).setFilter(diffs).find();
    assertNotNull(blob.get());

    Repository repo = new FileRepository(testRepo) {

      public ObjectLoader open(AnyObjectId objectId, int typeHint)
View Full Code Here

          ids.add(diff.getNewId());
        return true;
      }

    };
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(2, ids.size());
    Collection<Edit> diffs = BlobUtils.diff(new FileRepository(testRepo),
        ids.get(0).toObjectId(), ids.get(1).toObjectId());
    assertNotNull(diffs);
    assertEquals(1, diffs.size());
View Full Code Here

          ids.add(diff.getNewId());
        return true;
      }

    };
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, ids.size());
    Collection<Edit> diffs = BlobUtils.diff(new FileRepository(testRepo),
        ids.get(0).toObjectId(), ObjectId.zeroId());
    assertNotNull(diffs);
    assertEquals(1, diffs.size());
View Full Code Here

          ids.add(diff.getNewId());
        return true;
      }

    };
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, ids.size());
    Collection<Edit> diffs = BlobUtils.diff(new FileRepository(testRepo),
        ids.get(0).toObjectId(), ObjectId.zeroId());
    assertNotNull(diffs);
    assertTrue(diffs.isEmpty());
View Full Code Here

          ids.add(diff.getNewId());
        return true;
      }

    };
    new CommitFinder(testRepo).setFilter(filter).find();
    assertEquals(1, ids.size());
    Collection<Edit> diffs = BlobUtils.diff(new FileRepository(testRepo),
        ObjectId.zeroId(), ids.get(0).toObjectId());
    assertNotNull(diffs);
    assertTrue(diffs.isEmpty());
View Full Code Here

          throws IOException {
        ref.set(diffs);
        return super.include(commit, diffs);
      }
    };
    new CommitFinder(testRepo).setFilter(filter).find();
    Collection<DiffEntry> diffs = ref.get();
    assertNotNull(diffs);
    assertEquals(1, diffs.size());
    DiffEntry diff = diffs.iterator().next();
    assertEquals(ChangeType.ADD, diff.getChangeType());
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.