Search in sources :

Example 6 with ChangeListManagerImpl

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

the class ChangelistConflictDialog method createLeftSideActions.

@NotNull
@Override
protected Action[] createLeftSideActions() {
    return new Action[] { new AbstractAction("&Configure...") {

        public void actionPerformed(ActionEvent e) {
            ChangeListManagerImpl manager = (ChangeListManagerImpl) ChangeListManager.getInstance(myProject);
            ShowSettingsUtil.getInstance().editConfigurable(myPanel, new ChangelistConflictConfigurable(manager));
        }
    } };
}
Also used : ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) ActionEvent(java.awt.event.ActionEvent) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with ChangeListManagerImpl

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

the class VcsAwareFormatChangedTextUtil method isChangeNotTrackedForFile.

@Override
public boolean isChangeNotTrackedForFile(@NotNull Project project, @NotNull PsiFile file) {
    boolean isUnderVcs = VcsUtil.isFileUnderVcs(project, VcsUtil.getFilePath(file.getVirtualFile()));
    if (!isUnderVcs)
        return true;
    ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(project);
    List<VirtualFile> unversionedFiles = changeListManager.getUnversionedFiles();
    if (unversionedFiles.contains(file.getVirtualFile())) {
        return true;
    }
    return false;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl)

Example 8 with ChangeListManagerImpl

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

the class SvnResolveTreeAcceptVariantsTest method testMineFull.

@Test
public void testMineFull() throws Exception {
    int cnt = 0;
    myWorkingCopyDir = createDirInCommand(myWorkingCopyDir, "test--");
    myTheirs = createDirInCommand(myTheirs, "theirs--");
    //final TreeConflictData.Data data = TreeConflictData.FileToFile.MINE_EDIT_THEIRS_MOVE;
    for (final TreeConflictData.Data data : TreeConflictData.ourAll) {
        if (myTraceClient) {
            System.out.println("========= TEST " + getTestName(data) + " =========");
        }
        ((ChangeListManagerImpl) myChangeListManager).stopEveryThingIfInTestMode();
        myWorkingCopyDir = createDirInCommand(myWorkingCopyDir.getParent(), "test" + cnt);
        myTheirs = createDirInCommand(myTheirs.getParent(), "theirs" + cnt);
        mySvnClientRunner.checkout(myRepoUrl, myTheirs);
        mySvnClientRunner.checkout(myRepoUrl, myWorkingCopyDir);
        sleep(200);
        ProjectLevelVcsManager.getInstance(myProject).setDirectoryMappings(Collections.singletonList(new VcsDirectoryMapping(myWorkingCopyDir.getPath(), myVcs.getName())));
        createSubTree(data);
        myTheirs.refresh(false, true);
        final ConflictCreator creator = new ConflictCreator(myProject, myTheirs, myWorkingCopyDir, data, mySvnClientRunner);
        creator.create();
        sleep(200);
        ((ChangeListManagerImpl) myChangeListManager).forceGoInTestMode();
        myDirtyScopeManager.markEverythingDirty();
        myChangeListManager.ensureUpToDate(false);
        myDirtyScopeManager.markEverythingDirty();
        myChangeListManager.ensureUpToDate(false);
        final String conflictFile = data.getConflictFile();
        final File conflictIoFile = new File(myWorkingCopyDir.getPath(), conflictFile);
        final FilePath filePath = VcsUtil.getFilePath(conflictIoFile);
        final Change change = myChangeListManager.getChange(filePath);
        Assert.assertNotNull(change);
        Assert.assertTrue(change instanceof ConflictedSvnChange);
        final SvnRevisionNumber committedRevision = change.getBeforeRevision() != null ? (SvnRevisionNumber) change.getBeforeRevision().getRevisionNumber() : null;
        //SvnRevisionNumber committedRevision = new SvnRevisionNumber(SVNRevision.create(cnt * 2 + 1));
        final SvnTreeConflictResolver resolver = new SvnTreeConflictResolver(myVcs, filePath, null);
        resolver.resolveSelectMineFull();
        myTheirs.refresh(false, true);
        myWorkingCopyDir.refresh(false, true);
        checkStatusesAfterMineFullResolve(data, conflictIoFile);
        checkFileContents(data, conflictIoFile);
        ++cnt;
    }
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) VcsDirectoryMapping(com.intellij.openapi.vcs.VcsDirectoryMapping) Change(com.intellij.openapi.vcs.changes.Change) SvnTreeConflictResolver(org.jetbrains.idea.svn.treeConflict.SvnTreeConflictResolver) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File) Test(org.junit.Test)

Example 9 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 {
    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();
    }
    if (!RepeatSvnActionThroughBusy.ourBusyExceptionProcessor.process(updateException)) {
        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)

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