Search in sources :

Example 1 with CommonUpdateProjectAction

use of com.intellij.openapi.vcs.update.CommonUpdateProjectAction in project intellij-community by JetBrains.

the class SvnTestCase method imitUpdate.

protected static void imitUpdate(final Project project) {
    ProjectLevelVcsManagerEx.getInstanceEx(project).getOptions(VcsConfiguration.StandardOption.UPDATE).setValue(false);
    final CommonUpdateProjectAction action = new CommonUpdateProjectAction();
    action.getTemplatePresentation().setText("1");
    action.actionPerformed(new AnActionEvent(null, dataId -> {
        if (CommonDataKeys.PROJECT.is(dataId)) {
            return project;
        }
        return null;
    }, "test", new Presentation(), ActionManager.getInstance(), 0));
    final ChangeListManager clManager = ChangeListManager.getInstance(project);
    clManager.ensureUpToDate(false);
    // wait for after-events like annotations recalculation
    clManager.ensureUpToDate(false);
    // zipper updater
    sleep(100);
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) PluginPathManager(com.intellij.openapi.application.PluginPathManager) VirtualFile(com.intellij.openapi.vfs.VirtualFile) com.intellij.openapi.vcs.changes(com.intellij.openapi.vcs.changes) Presentation(com.intellij.openapi.actionSystem.Presentation) VirtualFileManager(com.intellij.openapi.vfs.VirtualFileManager) StartupManagerImpl(com.intellij.ide.startup.impl.StartupManagerImpl) MockChangelistBuilder(com.intellij.testFramework.vcs.MockChangelistBuilder) Semaphore(com.intellij.util.concurrency.Semaphore) After(org.junit.After) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) Messages(com.intellij.openapi.ui.Messages) SvnVcs(org.jetbrains.idea.svn.SvnVcs) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) FileUtil(com.intellij.openapi.util.io.FileUtil) VcsException(com.intellij.openapi.vcs.VcsException) SvnConfiguration(org.jetbrains.idea.svn.SvnConfiguration) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) SvnFileUrlMappingImpl(org.jetbrains.idea.svn.SvnFileUrlMappingImpl) MockChangeListManagerGate(com.intellij.testFramework.vcs.MockChangeListManagerGate) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) Nullable(org.jetbrains.annotations.Nullable) TimeoutUtil(com.intellij.util.TimeoutUtil) Processor(com.intellij.util.Processor) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) ApplicationManager(com.intellij.openapi.application.ApplicationManager) VcsShowConfirmationOption(com.intellij.openapi.vcs.VcsShowConfirmationOption) NotNull(org.jetbrains.annotations.NotNull) java.util(java.util) TempDirTestFixture(com.intellij.testFramework.fixtures.TempDirTestFixture) PathManager(com.intellij.openapi.application.PathManager) ActionManager(com.intellij.openapi.actionSystem.ActionManager) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) StartupManager(com.intellij.openapi.startup.StartupManager) Project(com.intellij.openapi.project.Project) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) Before(org.junit.Before) StringUtil(com.intellij.openapi.util.text.StringUtil) TestClientRunner(com.intellij.testFramework.vcs.TestClientRunner) IOException(java.io.IOException) TestDialog(com.intellij.openapi.ui.TestDialog) CreateExternalAction(org.jetbrains.idea.svn.actions.CreateExternalAction) VFileContentChangeEvent(com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent) SystemInfo(com.intellij.openapi.util.SystemInfo) File(java.io.File) AbstractJunitVcsTestCase(com.intellij.testFramework.vcs.AbstractJunitVcsTestCase) UndoManager(com.intellij.openapi.command.undo.UndoManager) BulkFileListener(com.intellij.openapi.vfs.newvfs.BulkFileListener) ProcessOutput(com.intellij.execution.process.ProcessOutput) SvnApplicationSettings(org.jetbrains.idea.svn.SvnApplicationSettings) Assert(org.junit.Assert) IdeaTestFixtureFactory(com.intellij.testFramework.fixtures.IdeaTestFixtureFactory) ZipUtil(com.intellij.util.io.ZipUtil) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 2 with CommonUpdateProjectAction

use of com.intellij.openapi.vcs.update.CommonUpdateProjectAction in project intellij-community by JetBrains.

the class SvnAnnotationIsClosedTest method testClosedChangedByUpdateInIdea.

@Test
public void testClosedChangedByUpdateInIdea() throws Exception {
    final SubTree tree = new SubTree(myWorkingCopyDir);
    //#1
    checkin();
    VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n");
    //#2
    checkin();
    VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n");
    //#3
    checkin();
    // take #2
    runInAndVerifyIgnoreOutput("up", "-r", "2");
    final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
    final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File);
    annotation.setCloser(() -> {
        myIsClosed = true;
        listener.unregisterAnnotation(tree.myS1File, annotation);
    });
    listener.registerAnnotation(tree.myS1File, annotation);
    VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1+\n2\n3\n4\n");
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    Assert.assertFalse(myIsClosed);
    ProjectLevelVcsManagerEx.getInstanceEx(myProject).getOptions(VcsConfiguration.StandardOption.UPDATE).setValue(false);
    final CommonUpdateProjectAction action = new CommonUpdateProjectAction();
    action.getTemplatePresentation().setText("1");
    action.actionPerformed(new AnActionEvent(null, dataId -> {
        if (CommonDataKeys.PROJECT.is(dataId)) {
            return myProject;
        }
        return null;
    }, "test", new Presentation(), ActionManager.getInstance(), 0));
    myChangeListManager.ensureUpToDate(false);
    // wait for after-events like annotations recalculation
    myChangeListManager.ensureUpToDate(false);
    // zipper updater
    sleep(100);
    Assert.assertTrue(myIsClosed);
}
Also used : VcsTestUtil(com.intellij.openapi.vcs.VcsTestUtil) FileAnnotation(com.intellij.openapi.vcs.annotate.FileAnnotation) Change(com.intellij.openapi.vcs.changes.Change) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) VcsRevisionDescription(com.intellij.openapi.vcs.history.VcsRevisionDescription) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsAnnotationLocalChangesListener(com.intellij.openapi.vcs.changes.VcsAnnotationLocalChangesListener) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) ProjectLevelVcsManager(com.intellij.openapi.vcs.ProjectLevelVcsManager) Presentation(com.intellij.openapi.actionSystem.Presentation) Test(org.junit.Test) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) File(java.io.File) ActionManager(com.intellij.openapi.actionSystem.ActionManager) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) List(java.util.List) Assert(junit.framework.Assert) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) VcsDirtyScopeManager(com.intellij.openapi.vcs.changes.VcsDirtyScopeManager) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) VcsException(com.intellij.openapi.vcs.VcsException) Collections(java.util.Collections) Before(org.junit.Before) VcsAnnotationLocalChangesListener(com.intellij.openapi.vcs.changes.VcsAnnotationLocalChangesListener) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) FileAnnotation(com.intellij.openapi.vcs.annotate.FileAnnotation) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Presentation(com.intellij.openapi.actionSystem.Presentation) Test(org.junit.Test)

Example 3 with CommonUpdateProjectAction

use of com.intellij.openapi.vcs.update.CommonUpdateProjectAction in project intellij-community by JetBrains.

the class SvnAnnotationIsClosedTest method testClosedByUpdateInIdea.

@Test
public void testClosedByUpdateInIdea() throws Exception {
    final SubTree tree = new SubTree(myWorkingCopyDir);
    //#1
    checkin();
    VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n");
    //#2
    checkin();
    VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n");
    //#3
    checkin();
    runInAndVerifyIgnoreOutput("up", "-r", "2");
    final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
    final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File);
    annotation.setCloser(() -> {
        myIsClosed = true;
        listener.unregisterAnnotation(tree.myS1File, annotation);
    });
    listener.registerAnnotation(tree.myS1File, annotation);
    myDirtyScopeManager.markEverythingDirty();
    myChangeListManager.ensureUpToDate(false);
    ProjectLevelVcsManagerEx.getInstanceEx(myProject).getOptions(VcsConfiguration.StandardOption.UPDATE).setValue(false);
    final CommonUpdateProjectAction action = new CommonUpdateProjectAction();
    action.getTemplatePresentation().setText("1");
    action.actionPerformed(new AnActionEvent(null, dataId -> {
        if (CommonDataKeys.PROJECT.is(dataId)) {
            return myProject;
        }
        return null;
    }, "test", new Presentation(), ActionManager.getInstance(), 0));
    myChangeListManager.ensureUpToDate(false);
    // wait for after-events like annotations recalculation
    myChangeListManager.ensureUpToDate(false);
    // zipper updater
    sleep(100);
    Assert.assertTrue(myIsClosed);
}
Also used : VcsTestUtil(com.intellij.openapi.vcs.VcsTestUtil) FileAnnotation(com.intellij.openapi.vcs.annotate.FileAnnotation) Change(com.intellij.openapi.vcs.changes.Change) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) VcsRevisionDescription(com.intellij.openapi.vcs.history.VcsRevisionDescription) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsAnnotationLocalChangesListener(com.intellij.openapi.vcs.changes.VcsAnnotationLocalChangesListener) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) ProjectLevelVcsManager(com.intellij.openapi.vcs.ProjectLevelVcsManager) Presentation(com.intellij.openapi.actionSystem.Presentation) Test(org.junit.Test) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) File(java.io.File) ActionManager(com.intellij.openapi.actionSystem.ActionManager) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) List(java.util.List) Assert(junit.framework.Assert) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) VcsDirtyScopeManager(com.intellij.openapi.vcs.changes.VcsDirtyScopeManager) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) VcsException(com.intellij.openapi.vcs.VcsException) Collections(java.util.Collections) Before(org.junit.Before) VcsAnnotationLocalChangesListener(com.intellij.openapi.vcs.changes.VcsAnnotationLocalChangesListener) CommonUpdateProjectAction(com.intellij.openapi.vcs.update.CommonUpdateProjectAction) FileAnnotation(com.intellij.openapi.vcs.annotate.FileAnnotation) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Presentation(com.intellij.openapi.actionSystem.Presentation) Test(org.junit.Test)

Aggregations

ActionManager (com.intellij.openapi.actionSystem.ActionManager)3 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)3 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)3 Presentation (com.intellij.openapi.actionSystem.Presentation)3 VcsConfiguration (com.intellij.openapi.vcs.VcsConfiguration)3 VcsException (com.intellij.openapi.vcs.VcsException)3 ProjectLevelVcsManagerEx (com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx)3 CommonUpdateProjectAction (com.intellij.openapi.vcs.update.CommonUpdateProjectAction)3 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 File (java.io.File)3 Before (org.junit.Before)3 ProjectLevelVcsManager (com.intellij.openapi.vcs.ProjectLevelVcsManager)2 VcsTestUtil (com.intellij.openapi.vcs.VcsTestUtil)2 FileAnnotation (com.intellij.openapi.vcs.annotate.FileAnnotation)2 Change (com.intellij.openapi.vcs.changes.Change)2 ChangeListManager (com.intellij.openapi.vcs.changes.ChangeListManager)2 VcsAnnotationLocalChangesListener (com.intellij.openapi.vcs.changes.VcsAnnotationLocalChangesListener)2 VcsDirtyScopeManager (com.intellij.openapi.vcs.changes.VcsDirtyScopeManager)2 VcsRevisionDescription (com.intellij.openapi.vcs.history.VcsRevisionDescription)2