private static void markDirty( @NotNull VcsDirtyScopeManager vcsDirtyScopeManager, @NotNull Collection<FilePath> directlyAffected, @NotNull Collection<VirtualFile> indirectlyAffected) { vcsDirtyScopeManager.filePathsDirty(directlyAffected, null); vcsDirtyScopeManager.filesDirty(indirectlyAffected, null); }
private boolean checkIfThereAreFakeRevisions(final Project project, final Change[] changes) { boolean needsConvertion = false; for (Change change : changes) { final ContentRevision beforeRevision = change.getBeforeRevision(); final ContentRevision afterRevision = change.getAfterRevision(); if (beforeRevision instanceof FakeRevision) { VcsDirtyScopeManager.getInstance(project).fileDirty(beforeRevision.getFile()); needsConvertion = true; } if (afterRevision instanceof FakeRevision) { VcsDirtyScopeManager.getInstance(project).fileDirty(afterRevision.getFile()); needsConvertion = true; } } return needsConvertion; }
@Override public void onFrameActivated() { final List<VirtualFile> folders = ((ChangeListManagerImpl) myClManager).getLockedFolders(); if (!folders.isEmpty()) { myDirtyScopeManager.filesDirty(null, folders); } }
public SvnVcs( final Project project, MessageBus bus, SvnConfiguration svnConfiguration, final SvnLoadedBrachesStorage storage) { super(project, VCS_NAME); myLoadedBranchesStorage = storage; LOG.debug("ct"); myRootsToWorkingCopies = new RootsToWorkingCopies(this); myConfiguration = svnConfiguration; myAuthNotifier = new SvnAuthenticationNotifier(this); dumpFileStatus(FileStatus.ADDED); dumpFileStatus(FileStatus.DELETED); dumpFileStatus(FileStatus.MERGE); dumpFileStatus(FileStatus.MODIFIED); dumpFileStatus(FileStatus.NOT_CHANGED); dumpFileStatus(FileStatus.UNKNOWN); dumpFileStatus(SvnFileStatus.REPLACED); dumpFileStatus(SvnFileStatus.EXTERNAL); dumpFileStatus(SvnFileStatus.OBSTRUCTED); final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project); myAddConfirmation = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, this); myDeleteConfirmation = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, this); myCheckoutOptions = vcsManager.getStandardOption(VcsConfiguration.StandardOption.CHECKOUT, this); if (myProject.isDefault()) { myChangeListListener = null; myEntriesFileListener = null; } else { myEntriesFileListener = new SvnEntriesFileListener(project); upgradeIfNeeded(bus); myChangeListListener = new SvnChangelistListener(myProject, this); myVcsListener = new VcsListener() { @Override public void directoryMappingChanged() { invokeRefreshSvnRoots(true); } }; } myFrameStateListener = project.isDefault() ? null : new MyFrameStateListener( ChangeListManager.getInstance(project), VcsDirtyScopeManager.getInstance(project)); myWorkingCopiesContent = new WorkingCopiesContent(this); // remove used some time before old notification group ids correctNotificationIds(); myChecker = new SvnExecutableChecker(myProject); }
@CalledInAwt public static void refreshPassedFilesAndMoveToChangelist( @NotNull final Project project, final Collection<FilePath> directlyAffected, final Collection<VirtualFile> indirectlyAffected, final Consumer<Collection<FilePath>> targetChangelistMover) { final LocalFileSystem lfs = LocalFileSystem.getInstance(); for (FilePath filePath : directlyAffected) { lfs.refreshAndFindFileByIoFile(filePath.getIOFile()); } if (project.isDisposed()) return; final ChangeListManager changeListManager = ChangeListManager.getInstance(project); if (!directlyAffected.isEmpty() && targetChangelistMover != null) { changeListManager.invokeAfterUpdate( new Runnable() { @Override public void run() { targetChangelistMover.consume(directlyAffected); } }, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, VcsBundle.message("change.lists.manager.move.changes.to.list"), new Consumer<VcsDirtyScopeManager>() { @Override public void consume(final VcsDirtyScopeManager vcsDirtyScopeManager) { markDirty(vcsDirtyScopeManager, directlyAffected, indirectlyAffected); } }, null); } else { markDirty(VcsDirtyScopeManager.getInstance(project), directlyAffected, indirectlyAffected); } }
@Override public void run(final ContinuationContext context) { if (myTheirsBinaryChanges.isEmpty()) return; final Application application = ApplicationManager.getApplication(); final List<FilePath> dirtyPaths = new ArrayList<FilePath>(); for (final Change change : myTheirsBinaryChanges) { try { application.runWriteAction( new ThrowableComputable<Void, VcsException>() { @Override public Void compute() throws VcsException { try { if (change.getAfterRevision() == null) { final FilePath path = change.getBeforeRevision().getFile(); dirtyPaths.add(path); final VirtualFile file = LocalFileSystem.getInstance() .refreshAndFindFileByIoFile(path.getIOFile()); if (file == null) { context.handleException( new VcsException("Can not delete file: " + file.getPath(), true), false); return null; } file.delete(TreeConflictRefreshablePanel.class); } else { final FilePath file = change.getAfterRevision().getFile(); dirtyPaths.add(file); final String parentPath = file.getParentPath().getPath(); final VirtualFile parentFile = VfsUtil.createDirectoryIfMissing(parentPath); if (parentFile == null) { context.handleException( new VcsException("Can not create directory: " + parentPath, true), false); return null; } final VirtualFile child = parentFile.createChildData( TreeConflictRefreshablePanel.class, file.getName()); if (child == null) { context.handleException( new VcsException("Can not create file: " + file.getPath(), true), false); return null; } final BinaryContentRevision revision = (BinaryContentRevision) change.getAfterRevision(); final byte[] content = revision.getBinaryContent(); // actually it was the fix for IDEA-91572 Error saving merged data: Argument 0 // for @NotNull parameter of > com/intellij/ if (content == null) { context.handleException( new VcsException( "Can not load Theirs content for file " + file.getPath()), false); return null; } child.setBinaryContent(content); } } catch (IOException e) { throw new VcsException(e); } return null; } }); } catch (VcsException e) { context.handleException(e, true); return; } } VcsDirtyScopeManager.getInstance(myVcs.getProject()).filePathsDirty(dirtyPaths, null); }