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);
}
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);
}
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);
}
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));
}
}
}
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;
}
Aggregations