private void processDeletedFiles(Project project) { final List<Pair<FilePath, WorkingCopyFormat>> deletedFiles = new ArrayList<Pair<FilePath, WorkingCopyFormat>>(); final Collection<FilePath> filesToProcess = new ArrayList<FilePath>(); List<VcsException> exceptions = new ArrayList<VcsException>(); final AbstractVcsHelper vcsHelper = AbstractVcsHelper.getInstance(project); try { fillDeletedFiles(project, deletedFiles, filesToProcess); if (deletedFiles.isEmpty() && filesToProcess.isEmpty() || myUndoingMove) return; SvnVcs vcs = SvnVcs.getInstance(project); final VcsShowConfirmationOption.Value value = vcs.getDeleteConfirmation().getValue(); if (value != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) { if (!deletedFiles.isEmpty()) { final Collection<FilePath> confirmed = promptAboutDeletion(deletedFiles, vcs, value, vcsHelper); if (confirmed != null) { filesToProcess.addAll(confirmed); } } if (filesToProcess != null && !filesToProcess.isEmpty()) { runInBackground( project, "Deleting files from Subversion", createDeleteRunnable(project, vcs, filesToProcess, exceptions)); } final List<FilePath> deletedFilesFiles = ObjectsConvertor.convert( deletedFiles, new Convertor<Pair<FilePath, WorkingCopyFormat>, FilePath>() { @Override public FilePath convert(Pair<FilePath, WorkingCopyFormat> o) { return o.getFirst(); } }); for (FilePath file : deletedFilesFiles) { final FilePath parent = file.getParentPath(); if (parent != null) { myFilesToRefresh.add(parent.getVirtualFile()); } } if (filesToProcess != null) { deletedFilesFiles.removeAll(filesToProcess); } for (FilePath file : deletedFilesFiles) { FileUtil.delete(file.getIOFile()); } } } catch (SVNException e) { exceptions.add(new VcsException(e)); } if (!exceptions.isEmpty()) { vcsHelper.showErrors(exceptions, SvnBundle.message("delete.files.errors.title")); } }
public void realRefresh() { final SvnVcs vcs = SvnVcs.getInstance(myProject); final VirtualFile[] roots = myHelper.executeDefended(myProject); final CopiesApplier copiesApplier = new CopiesApplier(); final CopiesDetector copiesDetector = new CopiesDetector( vcs, copiesApplier, new Getter<NestedCopiesData>() { public NestedCopiesData get() { return myTempSink.receive(); } }); // do not send additional request for nested copies when in init state copiesDetector.detectCopyRoots(roots, init()); }
private void fillMapping(final SvnMapping mapping, final List<SvnCopyRootSimple> list) { final LocalFileSystem lfs = LocalFileSystem.getInstance(); for (SvnCopyRootSimple simple : list) { final VirtualFile copyRoot = lfs.findFileByIoFile(new File(simple.myCopyRoot)); final VirtualFile vcsRoot = lfs.findFileByIoFile(new File(simple.myVcsRoot)); if (copyRoot == null || vcsRoot == null) continue; final SvnVcs vcs = SvnVcs.getInstance(myProject); final SVNInfo svnInfo = vcs.getInfo(copyRoot); if ((svnInfo == null) || (svnInfo.getRepositoryRootURL() == null)) continue; final RootUrlInfo info = new RootUrlInfo( svnInfo.getRepositoryRootURL(), svnInfo.getURL(), SvnFormatSelector.getWorkingCopyFormat(svnInfo.getFile()), copyRoot, vcsRoot); mapping.add(info); } }
public void checkIfCopyRootWasReported() { if (!myMetCurrentItem && myCurrentItem.isIsInnerCopyRoot()) { myMetCurrentItem = true; final SVNStatus statusInner = SvnUtil.getStatus(SvnVcs.getInstance(myProject), myCurrentItem.getPath().getIOFile()); if (statusInner == null) return; final SVNStatusType status = statusInner.getNodeStatus(); if (SVNStatusType.OBSTRUCTED.equals(status) || SVNStatusType.STATUS_IGNORED.equals(status) || SVNStatusType.STATUS_NONE.equals(status) || SVNStatusType.STATUS_UNVERSIONED.equals(status) || SVNStatusType.UNKNOWN.equals(status)) { return; } if (myCurrentItem.getPath().getVirtualFile() != null) { myReceiver.processCopyRoot( myCurrentItem.getPath().getVirtualFile(), statusInner.getURL(), WorkingCopyFormat.getInstance(statusInner.getWorkingCopyFormat())); } } }
private void processAddedFiles(Project project) { SvnVcs vcs = SvnVcs.getInstance(project); List<VirtualFile> addedVFiles = new ArrayList<VirtualFile>(); Map<VirtualFile, File> copyFromMap = new HashMap<VirtualFile, File>(); final Set<VirtualFile> recursiveItems = new HashSet<VirtualFile>(); fillAddedFiles(project, vcs, addedVFiles, copyFromMap, recursiveItems); if (addedVFiles.isEmpty()) return; final VcsShowConfirmationOption.Value value = vcs.getAddConfirmation().getValue(); if (value != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) { final AbstractVcsHelper vcsHelper = AbstractVcsHelper.getInstance(project); final Collection<VirtualFile> filesToProcess = promptAboutAddition(vcs, addedVFiles, value, vcsHelper); if (filesToProcess != null && !filesToProcess.isEmpty()) { final List<VcsException> exceptions = new ArrayList<VcsException>(); runInBackground( project, "Adding files to Subversion", createAdditionRunnable(project, vcs, copyFromMap, filesToProcess, exceptions)); if (!exceptions.isEmpty()) { vcsHelper.showErrors(exceptions, SvnBundle.message("add.files.errors.title")); } } } }
private void fillDeletedFiles( Project project, List<Pair<FilePath, WorkingCopyFormat>> deletedFiles, Collection<FilePath> deleteAnyway) throws SVNException { final SvnVcs vcs = SvnVcs.getInstance(project); final Collection<File> files = myDeletedFiles.remove(project); for (final File file : files) { final SVNStatus status = new RepeatSvnActionThroughBusy() { @Override protected void executeImpl() throws SVNException { myT = vcs.getFactory(file).createStatusClient().doStatus(file, false); } }.compute(); boolean isAdded = SVNStatusType.STATUS_ADDED.equals(status.getNodeStatus()); final FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(file); if (isAdded) { deleteAnyway.add(filePath); } else { deletedFiles.add(Pair.create(filePath, vcs.getWorkingCopyFormat(file))); } } }
protected VirtualFile[] execute(Project project) { return myPlVcsManager.getRootsUnderVcs(SvnVcs.getInstance(project)); }