public void test_support_equally_named_branch_and_tag() throws Exception { prepareSomeHistory(); git("branch build"); git("tag build"); VcsLogProvider.DetailedLogData data = myLogProvider.readFirstBlock( myProjectRoot, new RequirementsImpl(1000, true, Collections.<VcsRef>emptySet())); List<VcsCommitMetadata> expectedLog = log(); assertOrderedEquals(data.getCommits(), expectedLog); assertTrue( ContainerUtil.exists( data.getRefs(), new Condition<VcsRef>() { @Override public boolean value(VcsRef ref) { return ref.getName().equals("build") && ref.getType() == GitRefManager.LOCAL_BRANCH; } })); assertTrue( ContainerUtil.exists( data.getRefs(), new Condition<VcsRef>() { @Override public boolean value(VcsRef ref) { return ref.getName().equals("build") && ref.getType() == GitRefManager.TAG; } })); }
public void test_get_current_user() throws Exception { VcsUser user = myLogProvider.getCurrentUser(myProjectRoot); assertNotNull("User is not defined", user); VcsUser expected = getDefaultUser(); assertEquals("User name is incorrect", expected.getName(), user.getName()); assertEquals("User email is incorrect", expected.getEmail(), user.getEmail()); }
public void test_all_log_with_tagged_branch() throws VcsException { prepareSomeHistory(); createTaggedBranch(); List<VcsCommitMetadata> expectedLog = log(); List<TimedVcsCommit> collector = ContainerUtil.newArrayList(); //noinspection unchecked myLogProvider.readAllHashes(myProjectRoot, new CollectConsumer<TimedVcsCommit>(collector)); assertOrderedEquals(expectedLog, collector); }
public void test_refresh_with_new_tagged_branch() throws VcsException { prepareSomeHistory(); Set<VcsRef> prevRefs = GitTestUtil.readAllRefs(myProjectRoot, myObjectsFactory); createTaggedBranch(); List<VcsCommitMetadata> expectedLog = log(); VcsLogProvider.DetailedLogData block = myLogProvider.readFirstBlock(myProjectRoot, new RequirementsImpl(1000, true, prevRefs)); assertSameElements(block.getCommits(), expectedLog); }
public void test_init_with_tagged_branch() throws VcsException { prepareSomeHistory(); List<VcsCommitMetadata> expectedLogWithoutTaggedBranch = log(); createTaggedBranch(); VcsLogProvider.DetailedLogData block = myLogProvider.readFirstBlock( myProjectRoot, new RequirementsImpl(1000, false, Collections.<VcsRef>emptySet())); assertOrderedEquals(block.getCommits(), expectedLogWithoutTaggedBranch); }
public void test_new_tag_on_old_commit() throws VcsException { prepareSomeHistory(); Set<VcsRef> prevRefs = GitTestUtil.readAllRefs(myProjectRoot, myObjectsFactory); List<VcsCommitMetadata> log = log(); String firstCommit = log.get(log.size() - 1).getId().asString(); git("tag NEW_TAG " + firstCommit); Set<VcsRef> refs = GitTestUtil.readAllRefs(myProjectRoot, myObjectsFactory); VcsLogProvider.DetailedLogData block = myLogProvider.readFirstBlock(myProjectRoot, new RequirementsImpl(1000, true, prevRefs)); assertSameElements(block.getRefs(), refs); }
@NotNull private List<String> getFilteredHashes( @Nullable VcsLogBranchFilter branchFilter, @Nullable VcsLogUserFilter userFilter) throws VcsException { VcsLogFilterCollectionImpl filters = new VcsLogFilterCollectionImpl(branchFilter, userFilter, null, null, null, null, null); List<TimedVcsCommit> commits = myLogProvider.getCommitsMatchingFilter(myProjectRoot, filters, -1); return ContainerUtil.map( commits, new Function<TimedVcsCommit, String>() { @Override public String fun(TimedVcsCommit commit) { return commit.getId().asString(); } }); }
public void test_dont_report_origin_HEAD() throws Exception { prepareSomeHistory(); git("update-ref refs/remotes/origin/HEAD master"); VcsLogProvider.DetailedLogData block = myLogProvider.readFirstBlock( myProjectRoot, new RequirementsImpl(1000, false, Collections.<VcsRef>emptySet())); assertFalse( "origin/HEAD should be ignored", ContainerUtil.exists( block.getRefs(), new Condition<VcsRef>() { @Override public boolean value(VcsRef ref) { return ref.getName().equals("origin/HEAD"); } })); }