Search in sources :

Example 21 with TreeConflictDescription

use of org.jetbrains.idea.svn.conflict.TreeConflictDescription in project intellij-community by JetBrains.

the class SvnTreeConflictDataTest method testDir2Dir_MINE_EDIT_THEIRS_MOVE.

@Test
public void testDir2Dir_MINE_EDIT_THEIRS_MOVE() throws Exception {
    final String conflictFile = createConflict(TreeConflictData.DirToDir.MINE_EDIT_THEIRS_MOVE);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
    changeListManager.ensureUpToDate(false);
    VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(myWorkingCopyDir.getPath(), conflictFile));
    Assert.assertNotNull(vf);
    final Change change = changeListManager.getChange(vf);
    Assert.assertTrue(change instanceof ConflictedSvnChange);
    TreeConflictDescription beforeDescription = ((ConflictedSvnChange) change).getBeforeDescription();
    Assert.assertNotNull(beforeDescription);
    final TreeConflictDescription afterDescription = ((ConflictedSvnChange) change).getAfterDescription();
    Assert.assertNull(afterDescription);
    Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
    Assert.assertEquals(ConflictAction.DELETE, beforeDescription.getConflictAction());
    Assert.assertTrue(beforeDescription.isTreeConflict());
    ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
    Assert.assertNotNull(leftVersion);
    Assert.assertTrue(leftVersion.isDirectory());
    final ConflictVersion version = beforeDescription.getSourceRightVersion();
    Assert.assertNotNull(version);
    Assert.assertTrue(version.isNone());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) TreeConflictDescription(org.jetbrains.idea.svn.conflict.TreeConflictDescription) ConflictVersion(org.jetbrains.idea.svn.conflict.ConflictVersion) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Example 22 with TreeConflictDescription

use of org.jetbrains.idea.svn.conflict.TreeConflictDescription in project intellij-community by JetBrains.

the class SvnTreeConflictDataTest method testFile2File_MINE_MOVE_THEIRS_EDIT.

@Test
public void testFile2File_MINE_MOVE_THEIRS_EDIT() throws Exception {
    final String conflictFile = createConflict(TreeConflictData.FileToFile.MINE_MOVE_THEIRS_EDIT);
    ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    changeListManager.ensureUpToDate(false);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    changeListManager.ensureUpToDate(false);
    VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(myWorkingCopyDir.getPath(), conflictFile));
    Assert.assertNotNull(vf);
    final Change change = changeListManager.getChange(vf);
    Assert.assertTrue(change instanceof ConflictedSvnChange);
    TreeConflictDescription beforeDescription = ((ConflictedSvnChange) change).getBeforeDescription();
    Assert.assertNotNull(beforeDescription);
    final TreeConflictDescription afterDescription = ((ConflictedSvnChange) change).getAfterDescription();
    Assert.assertNull(afterDescription);
    Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
    Assert.assertEquals(ConflictAction.EDIT, beforeDescription.getConflictAction());
    Assert.assertTrue(beforeDescription.isTreeConflict());
    ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
    Assert.assertNotNull(leftVersion);
    Assert.assertTrue(leftVersion.isFile());
    final ConflictVersion version = beforeDescription.getSourceRightVersion();
    Assert.assertNotNull(version);
    Assert.assertTrue(version.isFile());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) TreeConflictDescription(org.jetbrains.idea.svn.conflict.TreeConflictDescription) ConflictVersion(org.jetbrains.idea.svn.conflict.ConflictVersion) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Example 23 with TreeConflictDescription

use of org.jetbrains.idea.svn.conflict.TreeConflictDescription in project intellij-community by JetBrains.

the class SvnTreeConflictDataTest method testDir2File_MINE_ADD_THEIRS_ADD.

@Test
public void testDir2File_MINE_ADD_THEIRS_ADD() throws Exception {
    final String conflictFile = createConflict(TreeConflictData.DirToFile.MINE_ADD_THEIRS_ADD);
    ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    changeListManager.ensureUpToDate(false);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    changeListManager.ensureUpToDate(false);
    VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(myWorkingCopyDir.getPath(), conflictFile));
    Assert.assertNotNull(vf);
    final Change change = changeListManager.getChange(vf);
    Assert.assertTrue(change instanceof ConflictedSvnChange);
    TreeConflictDescription beforeDescription = ((ConflictedSvnChange) change).getBeforeDescription();
    Assert.assertNotNull(beforeDescription);
    final TreeConflictDescription afterDescription = ((ConflictedSvnChange) change).getAfterDescription();
    Assert.assertNull(afterDescription);
    Assert.assertEquals(ConflictOperation.UPDATE, beforeDescription.getOperation());
    Assert.assertEquals(ConflictAction.ADD, beforeDescription.getConflictAction());
    Assert.assertTrue(beforeDescription.isTreeConflict());
    ConflictVersion leftVersion = beforeDescription.getSourceLeftVersion();
    Assert.assertNull(leftVersion);
    final ConflictVersion version = beforeDescription.getSourceRightVersion();
    Assert.assertNotNull(version);
    Assert.assertTrue(version.isFile());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) TreeConflictDescription(org.jetbrains.idea.svn.conflict.TreeConflictDescription) ConflictVersion(org.jetbrains.idea.svn.conflict.ConflictVersion) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Example 24 with TreeConflictDescription

use of org.jetbrains.idea.svn.conflict.TreeConflictDescription in project intellij-community by JetBrains.

the class SvnTreeConflictDiffRequestProvider method isEquals.

@NotNull
@Override
public ThreeState isEquals(@NotNull Change change1, @NotNull Change change2) {
    if (change1 instanceof ConflictedSvnChange && change2 instanceof ConflictedSvnChange) {
        if (!change1.isTreeConflict() && !change2.isTreeConflict())
            return ThreeState.UNSURE;
        if (!change1.isTreeConflict() || !change2.isTreeConflict())
            return ThreeState.NO;
        TreeConflictDescription description1 = ((ConflictedSvnChange) change1).getBeforeDescription();
        TreeConflictDescription description2 = ((ConflictedSvnChange) change2).getBeforeDescription();
        return TreeConflictRefreshablePanel.descriptionsEqual(description1, description2) ? ThreeState.YES : ThreeState.NO;
    }
    return ThreeState.UNSURE;
}
Also used : TreeConflictDescription(org.jetbrains.idea.svn.conflict.TreeConflictDescription) ConflictedSvnChange(org.jetbrains.idea.svn.ConflictedSvnChange) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TreeConflictDescription (org.jetbrains.idea.svn.conflict.TreeConflictDescription)24 Change (com.intellij.openapi.vcs.changes.Change)23 ChangeListManager (com.intellij.openapi.vcs.changes.ChangeListManager)23 VirtualFile (com.intellij.openapi.vfs.VirtualFile)23 File (java.io.File)23 ConflictVersion (org.jetbrains.idea.svn.conflict.ConflictVersion)23 Test (org.junit.Test)23 NotNull (org.jetbrains.annotations.NotNull)1 ConflictedSvnChange (org.jetbrains.idea.svn.ConflictedSvnChange)1