Search in sources :

Example 1 with ISVNStatusFileProvider

use of org.tmatesoft.svn.core.wc.ISVNStatusFileProvider in project intellij-community by JetBrains.

the class SvnChangeProvider method createFileProvider.

@NotNull
private static ISVNStatusFileProvider createFileProvider(@NotNull Map<String, SvnScopeZipper.MyDirNonRecursive> nonRecursiveMap) {
    final Map<String, Map<String, File>> result = ContainerUtil.newHashMap();
    for (SvnScopeZipper.MyDirNonRecursive item : nonRecursiveMap.values()) {
        File file = item.getDir().getIOFile();
        Map<String, File> fileMap = ContainerUtil.getOrCreate(result, file.getAbsolutePath(), NAME_TO_FILE_MAP_FACTORY);
        for (FilePath path : item.getChildrenList()) {
            fileMap.put(path.getName(), path.getIOFile());
        }
        // see http://issues.tmatesoft.com/issue/SVNKIT-567 for details
        if (file.getParentFile() != null) {
            Map<String, File> parentMap = ContainerUtil.getOrCreate(result, file.getParentFile().getAbsolutePath(), NAME_TO_FILE_MAP_FACTORY);
            parentMap.put(file.getName(), file);
        }
    }
    return parent -> result.get(parent.getAbsolutePath());
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) FileStatus(com.intellij.openapi.vcs.FileStatus) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) java.util(java.util) EventDispatcher(com.intellij.util.EventDispatcher) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Document(com.intellij.openapi.editor.Document) com.intellij.openapi.vcs.changes(com.intellij.openapi.vcs.changes) NotNullFactory(com.intellij.openapi.util.NotNullFactory) Computable(com.intellij.openapi.util.Computable) SvnExceptionWrapper(org.jetbrains.idea.svn.commandLine.SvnExceptionWrapper) ContainerUtil(com.intellij.util.containers.ContainerUtil) CleanupWorker(org.jetbrains.idea.svn.actions.CleanupWorker) Comparing(com.intellij.openapi.util.Comparing) VcsContextFactory(com.intellij.openapi.vcs.actions.VcsContextFactory) Logger(com.intellij.openapi.diagnostic.Logger) VcsException(com.intellij.openapi.vcs.VcsException) FilePath(com.intellij.openapi.vcs.FilePath) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) ProgressManager(com.intellij.openapi.progress.ProgressManager) VcsUtil(com.intellij.vcsUtil.VcsUtil) SVNException(org.tmatesoft.svn.core.SVNException) StringUtil(com.intellij.openapi.util.text.StringUtil) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) Status(org.jetbrains.idea.svn.status.Status) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable) StatusType(org.jetbrains.idea.svn.status.StatusType) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) Depth(org.jetbrains.idea.svn.api.Depth) ISVNStatusFileProvider(org.tmatesoft.svn.core.wc.ISVNStatusFileProvider) SVNURL(org.tmatesoft.svn.core.SVNURL) ApplicationManager(com.intellij.openapi.application.ApplicationManager) ObjectUtils(com.intellij.util.ObjectUtils) NotNull(org.jetbrains.annotations.NotNull) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with ISVNStatusFileProvider

use of org.tmatesoft.svn.core.wc.ISVNStatusFileProvider in project intellij-community by JetBrains.

the class SvnChangeProvider method getChanges.

public void getChanges(@NotNull VcsDirtyScope dirtyScope, @NotNull ChangelistBuilder builder, @NotNull ProgressIndicator progress, @NotNull ChangeListManagerGate addGate) throws VcsException {
    final SvnScopeZipper zipper = new SvnScopeZipper(dirtyScope);
    zipper.run();
    final Map<String, SvnScopeZipper.MyDirNonRecursive> nonRecursiveMap = zipper.getNonRecursiveDirs();
    final ISVNStatusFileProvider fileProvider = createFileProvider(nonRecursiveMap);
    try {
        final SvnChangeProviderContext context = new SvnChangeProviderContext(myVcs, builder, progress);
        final NestedCopiesBuilder nestedCopiesBuilder = new NestedCopiesBuilder(myVcs, mySvnFileUrlMapping);
        final EventDispatcher<StatusReceiver> statusReceiver = EventDispatcher.create(StatusReceiver.class);
        statusReceiver.addListener(context);
        statusReceiver.addListener(nestedCopiesBuilder);
        final SvnRecursiveStatusWalker walker = new SvnRecursiveStatusWalker(myVcs, statusReceiver.getMulticaster(), progress);
        for (FilePath path : zipper.getRecursiveDirs()) {
            walker.go(path, Depth.INFINITY);
        }
        walker.setFileProvider(fileProvider);
        for (SvnScopeZipper.MyDirNonRecursive item : nonRecursiveMap.values()) {
            walker.go(item.getDir(), Depth.IMMEDIATES);
        }
        statusReceiver.getMulticaster().finish();
        processCopiedAndDeleted(context, dirtyScope);
        processUnsaved(dirtyScope, addGate, context);
        final Set<NestedCopyInfo> nestedCopies = nestedCopiesBuilder.getCopies();
        mySvnFileUrlMapping.acceptNestedData(nestedCopies);
        putAdministrative17UnderVfsListener(nestedCopies);
    } catch (SvnExceptionWrapper e) {
        LOG.info(e);
        throw new VcsException(e.getCause());
    } catch (SVNException e) {
        if (e.getCause() != null) {
            throw new VcsException(e.getMessage() + " " + e.getCause().getMessage(), e);
        }
        throw new VcsException(e);
    }
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) ISVNStatusFileProvider(org.tmatesoft.svn.core.wc.ISVNStatusFileProvider) SVNException(org.tmatesoft.svn.core.SVNException) VcsException(com.intellij.openapi.vcs.VcsException) SvnExceptionWrapper(org.jetbrains.idea.svn.commandLine.SvnExceptionWrapper)

Aggregations

FilePath (com.intellij.openapi.vcs.FilePath)2 VcsException (com.intellij.openapi.vcs.VcsException)2 SvnExceptionWrapper (org.jetbrains.idea.svn.commandLine.SvnExceptionWrapper)2 SVNException (org.tmatesoft.svn.core.SVNException)2 ISVNStatusFileProvider (org.tmatesoft.svn.core.wc.ISVNStatusFileProvider)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 Logger (com.intellij.openapi.diagnostic.Logger)1 Document (com.intellij.openapi.editor.Document)1 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 Comparing (com.intellij.openapi.util.Comparing)1 Computable (com.intellij.openapi.util.Computable)1 NotNullFactory (com.intellij.openapi.util.NotNullFactory)1 StringUtil (com.intellij.openapi.util.text.StringUtil)1 FileStatus (com.intellij.openapi.vcs.FileStatus)1 VcsContextFactory (com.intellij.openapi.vcs.actions.VcsContextFactory)1 com.intellij.openapi.vcs.changes (com.intellij.openapi.vcs.changes)1 LocalFileSystem (com.intellij.openapi.vfs.LocalFileSystem)1 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)1