Search in sources :

Example 1 with ChangeListManagerImpl

use of com.intellij.openapi.vcs.changes.ChangeListManagerImpl in project intellij-community by JetBrains.

the class SvnChangesCorrectlyRefreshedNativeTest method testModificationAndAfterRevert.

@Test
public void testModificationAndAfterRevert() throws Exception {
    final SvnTestCase.SubTree subTree = new SubTree(myWorkingCopyDir);
    checkin();
    sleep(100);
    VcsTestUtil.editFileInCommand(myProject, subTree.myS1File, "new content");
    final CharSequence text1 = LoadTextUtil.loadText(subTree.myS1File);
    Assert.assertEquals("new content", text1.toString());
    sleep(100);
    LocalFileSystem.getInstance().refreshAndFindFileByIoFile(virtualToIoFile(subTree.myS1File));
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    final VcsException updateException = ((ChangeListManagerImpl) clManager).getUpdateException();
    if (updateException != null) {
        updateException.printStackTrace();
    }
    Assert.assertNull(updateException == null ? null : updateException.getMessage(), updateException);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] { subTree.myS1File }, clManager.getDefaultListName(), clManager);
    final Collection<Change> changes = clManager.getDefaultChangeList().getChanges();
    final RollbackWorker worker = new RollbackWorker(myProject);
    worker.doRollback(changes, false, null, null);
    final CharSequence text = LoadTextUtil.loadText(subTree.myS1File);
    Assert.assertEquals(SubTree.ourS1Contents, text.toString());
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
Also used : SvnTestCase(org.jetbrains.idea.SvnTestCase) ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) VcsException(com.intellij.openapi.vcs.VcsException) Change(com.intellij.openapi.vcs.changes.Change) RollbackWorker(com.intellij.openapi.vcs.changes.ui.RollbackWorker) Test(org.junit.Test)

Example 2 with ChangeListManagerImpl

use of com.intellij.openapi.vcs.changes.ChangeListManagerImpl in project intellij-community by JetBrains.

the class SvnChangesCorrectlyRefreshedNativeTest method testModificationAndAfterRevert.

@Test
public void testModificationAndAfterRevert() throws Exception {
    final SubTree subTree = new SubTree(myWorkingCopyDir);
    checkin();
    sleep(100);
    VcsTestUtil.editFileInCommand(myProject, subTree.myS1File, "new content");
    final CharSequence text1 = LoadTextUtil.loadText(subTree.myS1File);
    Assert.assertEquals("new content", text1.toString());
    sleep(100);
    LocalFileSystem.getInstance().refreshAndFindFileByIoFile(virtualToIoFile(subTree.myS1File));
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    final VcsException updateException = ((ChangeListManagerImpl) clManager).getUpdateException();
    if (updateException != null) {
        updateException.printStackTrace();
    }
    Assert.assertNull(updateException == null ? null : updateException.getMessage(), updateException);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] { subTree.myS1File }, clManager.getDefaultListName(), clManager);
    final Collection<Change> changes = clManager.getDefaultChangeList().getChanges();
    final RollbackWorker worker = new RollbackWorker(myProject);
    worker.doRollback(changes, false, null, null);
    final CharSequence text = LoadTextUtil.loadText(subTree.myS1File);
    Assert.assertEquals(SubTree.ourS1Contents, text.toString());
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
Also used : ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) VcsException(com.intellij.openapi.vcs.VcsException) Change(com.intellij.openapi.vcs.changes.Change) RollbackWorker(com.intellij.openapi.vcs.changes.ui.RollbackWorker) Test(org.junit.Test)

Example 3 with ChangeListManagerImpl

use of com.intellij.openapi.vcs.changes.ChangeListManagerImpl in project intellij-community by JetBrains.

the class SvnChangesCorrectlyRefreshedTest method testModificationAndAfterRevert.

@Test
public void testModificationAndAfterRevert() throws Exception {
    //ChangeListManagerImpl.DEBUG = true;
    final SubTree subTree = new SubTree(myWorkingCopyDir);
    checkin();
    sleep(100);
    VcsTestUtil.editFileInCommand(myProject, subTree.myS1File, "new content");
    final CharSequence text1 = LoadTextUtil.loadText(subTree.myS1File);
    Assert.assertEquals("new content", text1.toString());
    sleep(100);
    LocalFileSystem.getInstance().refreshAndFindFileByIoFile(virtualToIoFile(subTree.myS1File));
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    final VcsException updateException = ((ChangeListManagerImpl) clManager).getUpdateException();
    if (updateException != null) {
        updateException.printStackTrace();
    }
    Assert.assertNull(updateException == null ? null : updateException.getMessage(), updateException);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] { subTree.myS1File }, clManager.getDefaultListName(), clManager);
    final Collection<Change> changes = clManager.getDefaultChangeList().getChanges();
    final RollbackWorker worker = new RollbackWorker(myProject);
    worker.doRollback(changes, false, null, null);
    final CharSequence text = LoadTextUtil.loadText(subTree.myS1File);
    Assert.assertEquals(SubTree.ourS1Contents, text.toString());
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
Also used : ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) VcsException(com.intellij.openapi.vcs.VcsException) Change(com.intellij.openapi.vcs.changes.Change) RollbackWorker(com.intellij.openapi.vcs.changes.ui.RollbackWorker) Test(org.junit.Test)

Example 4 with ChangeListManagerImpl

use of com.intellij.openapi.vcs.changes.ChangeListManagerImpl in project intellij-community by JetBrains.

the class ConversionResultImpl method postStartupActivity.

@Override
public void postStartupActivity(@NotNull Project project) {
    final Application application = ApplicationManager.getApplication();
    if (application.isHeadlessEnvironment() || application.isUnitTestMode()) {
        return;
    }
    List<VirtualFile> changedFiles = findVirtualFiles(myChangedFiles);
    if (!changedFiles.isEmpty()) {
        EditAction.editFilesAndShowErrors(project, changedFiles);
    }
    final List<VirtualFile> createdFiles = findVirtualFiles(myCreatedFiles);
    if (containsFilesUnderVcs(createdFiles, project)) {
        final VcsShowConfirmationOptionImpl option = new VcsShowConfirmationOptionImpl("", "", "", "", "");
        final Collection<VirtualFile> selected = AbstractVcsHelper.getInstance(project).selectFilesToProcess(createdFiles, "Files Created", "Select files to be added to version control", null, null, option);
        if (selected != null && !selected.isEmpty()) {
            final ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(project);
            changeListManager.addUnversionedFiles(changeListManager.getDefaultChangeList(), new ArrayList<>(selected));
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) VcsShowConfirmationOptionImpl(com.intellij.openapi.vcs.VcsShowConfirmationOptionImpl) Application(com.intellij.openapi.application.Application)

Example 5 with ChangeListManagerImpl

use of com.intellij.openapi.vcs.changes.ChangeListManagerImpl in project intellij-community by JetBrains.

the class ScheduleForAdditionAction method addUnversioned.

public static boolean addUnversioned(@NotNull Project project, @NotNull List<VirtualFile> files, @NotNull Condition<FileStatus> unversionedFileCondition, @Nullable ChangesBrowserBase browser) {
    boolean result = true;
    if (!files.isEmpty()) {
        FileDocumentManager.getInstance().saveAllDocuments();
        @SuppressWarnings("unchecked") Consumer<List<Change>> consumer = browser == null ? null : changes -> {
            browser.rebuildList();
            browser.getViewer().excludeChanges((List) files);
            browser.getViewer().includeChanges((List) changes);
        };
        ChangeListManagerImpl manager = ChangeListManagerImpl.getInstanceImpl(project);
        LocalChangeList targetChangeList = browser == null ? manager.getDefaultChangeList() : (LocalChangeList) browser.getSelectedChangeList();
        List<VcsException> exceptions = manager.addUnversionedFiles(targetChangeList, files, unversionedFileCondition, consumer);
        result = exceptions.isEmpty();
    }
    return result;
}
Also used : ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) List(java.util.List)

Aggregations

ChangeListManagerImpl (com.intellij.openapi.vcs.changes.ChangeListManagerImpl)9 Change (com.intellij.openapi.vcs.changes.Change)5 Test (org.junit.Test)5 VcsException (com.intellij.openapi.vcs.VcsException)4 RollbackWorker (com.intellij.openapi.vcs.changes.ui.RollbackWorker)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 Application (com.intellij.openapi.application.Application)1 FilePath (com.intellij.openapi.vcs.FilePath)1 VcsDirectoryMapping (com.intellij.openapi.vcs.VcsDirectoryMapping)1 VcsShowConfirmationOptionImpl (com.intellij.openapi.vcs.VcsShowConfirmationOptionImpl)1 LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)1 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)1 ActionEvent (java.awt.event.ActionEvent)1 File (java.io.File)1 List (java.util.List)1 NotNull (org.jetbrains.annotations.NotNull)1 SvnTestCase (org.jetbrains.idea.SvnTestCase)1 SvnTreeConflictResolver (org.jetbrains.idea.svn.treeConflict.SvnTreeConflictResolver)1