Search in sources :

Example 1 with FileGroupInfo

use of org.jetbrains.idea.svn.ignore.FileGroupInfo in project intellij-community by JetBrains.

the class IgnoreActionGroup method update.

public void update(final AnActionEvent e) {
    final FileGroupInfo fileGroupInfo = new FileGroupInfo();
    myHelperAction.setFileIterationListener(fileGroupInfo);
    myHelperAction.update(e);
    myGetterStub.setDelegate(fileGroupInfo);
    if ((e.getPresentation().isEnabled())) {
        removeAll();
        if (myHelperAction.allAreIgnored()) {
            final DataContext dataContext = e.getDataContext();
            final Project project = CommonDataKeys.PROJECT.getData(dataContext);
            SvnVcs vcs = SvnVcs.getInstance(project);
            final Ref<Boolean> filesOk = new Ref<>(Boolean.FALSE);
            final Ref<Boolean> extensionOk = new Ref<>(Boolean.FALSE);
            // virtual files parameter is not used -> can pass null
            SvnPropertyService.doCheckIgnoreProperty(vcs, null, fileGroupInfo, fileGroupInfo.getExtensionMask(), filesOk, extensionOk);
            if (Boolean.TRUE.equals(filesOk.get())) {
                myRemoveExactAction.setActionText(fileGroupInfo.oneFileSelected() ? fileGroupInfo.getFileName() : SvnBundle.message("action.Subversion.UndoIgnore.text"));
                add(myRemoveExactAction);
            }
            if (Boolean.TRUE.equals(extensionOk.get())) {
                myRemoveExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
                add(myRemoveExtensionAction);
            }
            e.getPresentation().setText(SvnBundle.message("group.RevertIgnoreChoicesGroup.text"));
        } else if (myHelperAction.allCanBeIgnored()) {
            final String ignoreExactlyName = (fileGroupInfo.oneFileSelected()) ? fileGroupInfo.getFileName() : SvnBundle.message("action.Subversion.Ignore.ExactMatch.text");
            myAddExactAction.setActionText(ignoreExactlyName);
            add(myAddExactAction);
            if (fileGroupInfo.sameExtension()) {
                myAddExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
                add(myAddExtensionAction);
            }
            e.getPresentation().setText(SvnBundle.message("group.IgnoreChoicesGroup.text"));
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) Ref(com.intellij.openapi.util.Ref) FileGroupInfo(org.jetbrains.idea.svn.ignore.FileGroupInfo) SvnVcs(org.jetbrains.idea.svn.SvnVcs)

Example 2 with FileGroupInfo

use of org.jetbrains.idea.svn.ignore.FileGroupInfo in project intellij-community by JetBrains.

the class SvnRollbackTest method testRollbackDirWithCommittedIgnored.

@Test
public void testRollbackDirWithCommittedIgnored() throws Exception {
    final SubTree tree = new SubTree(myWorkingCopyDir);
    checkin();
    disableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    VirtualFile ignored = createFileInCommand(tree.mySourceDir, "ign.txt", "ignored");
    final File wasIgnored = virtualToIoFile(ignored);
    final FileGroupInfo groupInfo = new FileGroupInfo();
    groupInfo.onFileEnabled(ignored);
    SvnPropertyService.doAddToIgnoreProperty(myVcs, false, new VirtualFile[] { ignored }, groupInfo);
    checkin();
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    VcsTestUtil.renameFileInCommand(myProject, tree.mySourceDir, "renamed");
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    final Change dirChange = assertRenamedChange(tree.mySourceDir);
    final Change s1Change = assertMovedChange(tree.myS1File);
    final Change s2Change = assertMovedChange(tree.myS2File);
    Assert.assertTrue(!wasIgnored.exists());
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    rollbackIMpl(Collections.singletonList(dirChange), Collections.emptyList());
    ignored = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wasIgnored);
    // ignored property was not committed
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    Assert.assertTrue(wasIgnored.exists());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) FileGroupInfo(org.jetbrains.idea.svn.ignore.FileGroupInfo) Test(org.junit.Test)

Example 3 with FileGroupInfo

use of org.jetbrains.idea.svn.ignore.FileGroupInfo in project intellij-community by JetBrains.

the class SvnRollbackTest method testRollbackDirWithCommittedIgnored.

@Test
public void testRollbackDirWithCommittedIgnored() throws Exception {
    final SubTree tree = new SubTree(myWorkingCopyDir);
    checkin();
    disableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    VirtualFile ignored = createFileInCommand(tree.mySourceDir, "ign.txt", "ignored");
    final File wasIgnored = virtualToIoFile(ignored);
    final FileGroupInfo groupInfo = new FileGroupInfo();
    groupInfo.onFileEnabled(ignored);
    SvnPropertyService.doAddToIgnoreProperty(myVcs, false, new VirtualFile[] { ignored }, groupInfo);
    checkin();
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    VcsTestUtil.renameFileInCommand(myProject, tree.mySourceDir, "renamed");
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    final Change dirChange = assertRenamedChange(tree.mySourceDir);
    final Change s1Change = assertMovedChange(tree.myS1File);
    final Change s2Change = assertMovedChange(tree.myS2File);
    Assert.assertTrue(!wasIgnored.exists());
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    rollbackIMpl(Collections.singletonList(dirChange), Collections.emptyList());
    ignored = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wasIgnored);
    // ignored property was not committed
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    Assert.assertTrue(wasIgnored.exists());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) FileGroupInfo(org.jetbrains.idea.svn.ignore.FileGroupInfo) Test(org.junit.Test)

Example 4 with FileGroupInfo

use of org.jetbrains.idea.svn.ignore.FileGroupInfo in project intellij-community by JetBrains.

the class SvnRollbackTest method testRollbackDirWithIgnored.

@Test
public void testRollbackDirWithIgnored() throws Exception {
    final SubTree tree = new SubTree(myWorkingCopyDir);
    checkin();
    disableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    VirtualFile ignored = createFileInCommand(tree.mySourceDir, "ign.txt", "ignored");
    final File wasIgnored = virtualToIoFile(ignored);
    final FileGroupInfo groupInfo = new FileGroupInfo();
    groupInfo.onFileEnabled(ignored);
    SvnPropertyService.doAddToIgnoreProperty(myVcs, false, new VirtualFile[] { ignored }, groupInfo);
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    VcsTestUtil.renameFileInCommand(myProject, tree.mySourceDir, "renamed");
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    final Change dirChange = assertRenamedChange(tree.mySourceDir);
    final Change s1Change = assertMovedChange(tree.myS1File);
    final Change s2Change = assertMovedChange(tree.myS2File);
    Assert.assertTrue(!wasIgnored.exists());
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    rollbackIMpl(Collections.singletonList(dirChange), Collections.emptyList());
    ignored = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wasIgnored);
    // ignored property was not committed
    Assert.assertTrue(FileStatus.UNKNOWN.equals(myChangeListManager.getStatus(ignored)));
    Assert.assertTrue(wasIgnored.exists());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) FileGroupInfo(org.jetbrains.idea.svn.ignore.FileGroupInfo) Test(org.junit.Test)

Example 5 with FileGroupInfo

use of org.jetbrains.idea.svn.ignore.FileGroupInfo in project intellij-community by JetBrains.

the class SvnRollbackTest method testRollbackDirWithIgnored.

@Test
public void testRollbackDirWithIgnored() throws Exception {
    final SubTree tree = new SubTree(myWorkingCopyDir);
    checkin();
    disableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    VirtualFile ignored = createFileInCommand(tree.mySourceDir, "ign.txt", "ignored");
    final File wasIgnored = virtualToIoFile(ignored);
    final FileGroupInfo groupInfo = new FileGroupInfo();
    groupInfo.onFileEnabled(ignored);
    SvnPropertyService.doAddToIgnoreProperty(myVcs, false, new VirtualFile[] { ignored }, groupInfo);
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    VcsTestUtil.renameFileInCommand(myProject, tree.mySourceDir, "renamed");
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    final Change dirChange = assertRenamedChange(tree.mySourceDir);
    final Change s1Change = assertMovedChange(tree.myS1File);
    final Change s2Change = assertMovedChange(tree.myS2File);
    Assert.assertTrue(!wasIgnored.exists());
    Assert.assertTrue(FileStatus.IGNORED.equals(myChangeListManager.getStatus(ignored)));
    rollbackIMpl(Collections.singletonList(dirChange), Collections.emptyList());
    ignored = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wasIgnored);
    // ignored property was not committed
    Assert.assertTrue(FileStatus.UNKNOWN.equals(myChangeListManager.getStatus(ignored)));
    Assert.assertTrue(wasIgnored.exists());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) FileGroupInfo(org.jetbrains.idea.svn.ignore.FileGroupInfo) Test(org.junit.Test)

Aggregations

FileGroupInfo (org.jetbrains.idea.svn.ignore.FileGroupInfo)5 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 File (java.io.File)4 Test (org.junit.Test)4 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Project (com.intellij.openapi.project.Project)1 Ref (com.intellij.openapi.util.Ref)1 SvnVcs (org.jetbrains.idea.svn.SvnVcs)1