mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix adding wc.db files to VFS to correctly handle external operations
IDEA-175916
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +29,6 @@ import com.intellij.openapi.vcs.FileStatus;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.actions.VcsContextFactory;
|
||||
import com.intellij.openapi.vcs.changes.*;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
@@ -48,9 +47,10 @@ import org.tmatesoft.svn.core.SVNURL;
|
||||
import org.tmatesoft.svn.core.wc.ISVNStatusFileProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -103,9 +103,7 @@ public class SvnChangeProvider implements ChangeProvider {
|
||||
processCopiedAndDeleted(context, dirtyScope);
|
||||
processUnsaved(dirtyScope, addGate, context);
|
||||
|
||||
final Set<NestedCopyInfo> nestedCopies = nestedCopiesBuilder.getCopies();
|
||||
mySvnFileUrlMapping.acceptNestedData(nestedCopies);
|
||||
putAdministrative17UnderVfsListener(nestedCopies);
|
||||
mySvnFileUrlMapping.acceptNestedData(nestedCopiesBuilder.getCopies());
|
||||
} catch (SvnExceptionWrapper e) {
|
||||
LOG.info(e);
|
||||
throw new VcsException(e.getCause());
|
||||
@@ -117,21 +115,6 @@ public class SvnChangeProvider implements ChangeProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Currently could not find exact case when "file status is not correctly refreshed after external commit" that is covered by this
|
||||
* TODO: code. So for now, checks for formats greater than 1.7 are not added here.
|
||||
*/
|
||||
private static void putAdministrative17UnderVfsListener(Set<NestedCopyInfo> pointInfos) {
|
||||
if (! SvnVcs.ourListenToWcDb) return;
|
||||
final LocalFileSystem lfs = LocalFileSystem.getInstance();
|
||||
for (NestedCopyInfo info : pointInfos) {
|
||||
if (WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat()) && ! NestedCopyType.switched.equals(info.getType())) {
|
||||
final VirtualFile root = info.getFile();
|
||||
lfs.refreshIoFiles(Collections.singletonList(SvnUtil.getWcDb(virtualToIoFile(root))), true, false, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void processUnsaved(@NotNull VcsDirtyScope dirtyScope,
|
||||
@NotNull ChangeListManagerGate addGate,
|
||||
@NotNull SvnChangeProviderContext context)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.changes.InvokeAfterUpdateMode;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -29,13 +30,11 @@ import org.tmatesoft.svn.core.SVNURL;
|
||||
import org.tmatesoft.svn.core.internal.util.SVNURLUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile;
|
||||
import static com.intellij.util.containers.ContainerUtil.map;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* @author Konstantin Kolosovsky.
|
||||
@@ -121,6 +120,7 @@ public class SvnRootsDetector {
|
||||
}
|
||||
|
||||
myResult.myTopRoots.addAll(nestedRoots);
|
||||
putWcDbFilesToVfs(myResult.myTopRoots);
|
||||
myMapping.applyDetectionResult(myResult);
|
||||
|
||||
callback.run();
|
||||
@@ -131,6 +131,19 @@ public class SvnRootsDetector {
|
||||
}, null);
|
||||
}
|
||||
|
||||
private static void putWcDbFilesToVfs(@NotNull Collection<RootUrlInfo> infos) {
|
||||
if (!SvnVcs.ourListenToWcDb) return;
|
||||
|
||||
List<File> wcDbFiles = infos.stream()
|
||||
.filter(info -> info.getFormat().isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN))
|
||||
.filter(info -> !NestedCopyType.switched.equals(info.getType()))
|
||||
.map(RootUrlInfo::getIoFile)
|
||||
.map(SvnUtil::getWcDb)
|
||||
.collect(toList());
|
||||
|
||||
LocalFileSystem.getInstance().refreshIoFiles(wcDbFiles);
|
||||
}
|
||||
|
||||
private void registerRootUrlFromNestedPoint(@NotNull NestedCopyInfo info, @NotNull List<RootUrlInfo> nestedRoots) {
|
||||
// TODO: Seems there could be issues if myTopRoots contains nested roots => RootUrlInfo.myRoot could be incorrect
|
||||
// TODO: (not nearest ancestor) for new RootUrlInfo
|
||||
|
||||
Reference in New Issue
Block a user