use of com.virtuslab.gitmachete.backend.api.SyncToParentStatus 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.gitmachete.backend.api.SyncToParentStatus 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.gitmachete.backend.api.SyncToParentStatus 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.gitmachete.backend.api.SyncToParentStatus in project git-machete-intellij-plugin by VirtusLab.
the class GitMacheteRepository_deriveSyncToParentStatusUnitTestSuite method neitherBranchPointedCommitIsAncestorOfParentPointedCommitNorTheOtherWay_outOfSync.
@Test
@SneakyThrows
public void neitherBranchPointedCommitIsAncestorOfParentPointedCommitNorTheOtherWay_outOfSync() {
// given
IGitCoreCommit parentCommit = createGitCoreCommit();
IGitCoreCommit childCommit = createGitCoreCommit();
IGitCoreLocalBranchSnapshot parentBranch = createGitCoreLocalBranch(parentCommit);
IGitCoreLocalBranchSnapshot childBranch = createGitCoreLocalBranch(childCommit);
PowerMockito.doReturn(false).when(gitCoreRepository).isAncestorOrEqual(parentCommit, childCommit);
PowerMockito.doReturn(false).when(gitCoreRepository).isAncestorOrEqual(childCommit, parentCommit);
// when
SyncToParentStatus syncToParentStatus = invokeDeriveSyncToParentStatus(childBranch, parentBranch, MISSING_FORK_POINT);
// then
Assert.assertEquals(SyncToParentStatus.OutOfSync, syncToParentStatus);
}
use of com.virtuslab.gitmachete.backend.api.SyncToParentStatus in project git-machete-intellij-plugin by VirtusLab.
the class GitMacheteRepository_deriveSyncToParentStatusUnitTestSuite method parentPointedCommitIsAncestorOfBranchPointedCommitButNotItsForkPoint_inSyncButOffForkPoint.
@Test
@SneakyThrows
public void parentPointedCommitIsAncestorOfBranchPointedCommitButNotItsForkPoint_inSyncButOffForkPoint() {
// given
IGitCoreCommit forkPointCommit = createGitCoreCommit();
IGitCoreCommit parentCommit = createGitCoreCommit();
IGitCoreCommit childCommit = createGitCoreCommit();
IGitCoreLocalBranchSnapshot parentBranch = createGitCoreLocalBranch(parentCommit);
IGitCoreLocalBranchSnapshot childBranch = createGitCoreLocalBranch(childCommit);
PowerMockito.doReturn(true).when(gitCoreRepository).isAncestorOrEqual(parentCommit, childCommit);
// when
SyncToParentStatus syncToParentStatus = invokeDeriveSyncToParentStatus(childBranch, parentBranch, forkPointCommit);
// then
Assert.assertEquals(SyncToParentStatus.InSyncButForkPointOff, syncToParentStatus);
}
Aggregations