use of com.virtuslab.gitcore.api.IGitCoreCommit in project git-machete-intellij-plugin by VirtusLab.
the class GitMacheteRepository_deriveParentAwareForkPointUnitTestSuite method parentIsNotAncestorOfForkPointAndParentIsAncestorOfChild.
@Test
@SneakyThrows
public void parentIsNotAncestorOfForkPointAndParentIsAncestorOfChild() {
// given
IGitCoreCommit forkPointCommit = createGitCoreCommit();
IGitCoreCommit parentCommit = createGitCoreCommit();
IGitCoreCommit childCommit = createGitCoreCommit();
IGitCoreLocalBranchSnapshot parentBranch = createGitCoreLocalBranch(parentCommit);
IGitCoreLocalBranchSnapshot childBranch = createGitCoreLocalBranch(childCommit);
PowerMockito.doReturn(Stream.of(forkPointCommit)).when(gitCoreRepository).ancestorsOf(childCommit);
PowerMockito.doReturn(false).when(gitCoreRepository).isAncestorOrEqual(parentCommit, forkPointCommit);
PowerMockito.doReturn(true).when(gitCoreRepository).isAncestorOrEqual(parentCommit, childCommit);
// when
Option<IGitCoreCommit> result = invokeDeriveParentAwareForkPoint(childBranch, parentBranch);
// then
Assert.assertTrue(result.isDefined());
Assert.assertEquals(parentCommit, result.get());
}
use of com.virtuslab.gitcore.api.IGitCoreCommit in project git-machete-intellij-plugin by VirtusLab.
the class GitMacheteRepository_deriveSyncToParentStatusUnitTestSuite method branchAndParentPointingSameCommitAndBranchNotJustCreated_merged.
@Test
public void branchAndParentPointingSameCommitAndBranchNotJustCreated_merged() {
// given
IGitCoreCommit commit = createGitCoreCommit();
IGitCoreLocalBranchSnapshot parentBranch = createGitCoreLocalBranch(commit);
IGitCoreLocalBranchSnapshot childBranch = createGitCoreLocalBranch(commit, new TestGitCoreReflogEntry());
// when
SyncToParentStatus syncToParentStatus = invokeDeriveSyncToParentStatus(childBranch, parentBranch, MISSING_FORK_POINT);
// then
Assert.assertEquals(SyncToParentStatus.MergedToParent, syncToParentStatus);
}
use of com.virtuslab.gitcore.api.IGitCoreCommit in project git-machete-intellij-plugin by VirtusLab.
the class GitMacheteRepository_deriveSyncToParentStatusUnitTestSuite method branchPointedCommitIsAncestorOfParentPointedCommit_merged.
@Test
@SneakyThrows
public void branchPointedCommitIsAncestorOfParentPointedCommit_merged() {
// given
IGitCoreCommit childCommit = createGitCoreCommit();
IGitCoreCommit parentCommit = createGitCoreCommit();
IGitCoreLocalBranchSnapshot childBranch = createGitCoreLocalBranch(childCommit);
IGitCoreLocalBranchSnapshot parentBranch = createGitCoreLocalBranch(parentCommit);
PowerMockito.doReturn(false).when(gitCoreRepository).isAncestorOrEqual(parentCommit, childCommit);
PowerMockito.doReturn(true).when(gitCoreRepository).isAncestorOrEqual(childCommit, parentCommit);
// when
SyncToParentStatus syncToParentStatus = invokeDeriveSyncToParentStatus(childBranch, parentBranch, MISSING_FORK_POINT);
// then
Assert.assertEquals(SyncToParentStatus.OutOfSync, syncToParentStatus);
}
use of com.virtuslab.gitcore.api.IGitCoreCommit in project git-machete-intellij-plugin by VirtusLab.
the class GitMacheteRepository_deriveSyncToParentStatusUnitTestSuite method branchAndParentPointingSameCommitAndBranchJustCreated_inSync.
@Test
public void branchAndParentPointingSameCommitAndBranchJustCreated_inSync() {
// given
IGitCoreCommit commit = createGitCoreCommit();
IGitCoreLocalBranchSnapshot parentBranch = createGitCoreLocalBranch(commit);
IGitCoreLocalBranchSnapshot childBranch = createGitCoreLocalBranch(commit);
// when
SyncToParentStatus syncToParentStatus = invokeDeriveSyncToParentStatus(childBranch, parentBranch, MISSING_FORK_POINT);
// then
Assert.assertEquals(SyncToParentStatus.InSync, syncToParentStatus);
}
use of com.virtuslab.gitcore.api.IGitCoreCommit in project git-machete-intellij-plugin by VirtusLab.
the class GitMacheteRepository_deriveParentAwareForkPointUnitTestSuite method parentAgnosticForkPointIsMissingAndParentIsNotAncestorOfChild.
@Test
@SneakyThrows
public void parentAgnosticForkPointIsMissingAndParentIsNotAncestorOfChild() {
// given
IGitCoreCommit childCommit = createGitCoreCommit();
IGitCoreCommit parentCommit = createGitCoreCommit();
IGitCoreLocalBranchSnapshot childBranch = createGitCoreLocalBranch(childCommit);
IGitCoreLocalBranchSnapshot parentBranch = createGitCoreLocalBranch(parentCommit);
PowerMockito.doReturn(Stream.empty()).when(gitCoreRepository).ancestorsOf(childCommit);
PowerMockito.doReturn(false).when(gitCoreRepository).isAncestorOrEqual(parentCommit, childCommit);
// when
Option<IGitCoreCommit> result = invokeDeriveParentAwareForkPoint(childBranch, parentBranch);
// then
Assert.assertTrue(result.isEmpty());
}
Aggregations