From 84bb2e65561cc9622abafea534921ff314dc3772 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 20 May 2019 19:52:52 +0300 Subject: [PATCH] p4: restore support for mappings Perforce roots can't be detected using simple `VcsRootChecker` and have no 'administrative pattern'. Instead `P4ConnectionCalculator` detects roots and filters them with `RootsConvertor`. This logic expects `MappingsToRoots` to return all roots from `DefaultVcsRootPolicy`, without additional filtering by `DefaultVcsRootChecker`. This fix inherits all issues of old implementation. A better solution would be to use `P4ConnectionCalculator` instead of generic root detection/validation logic in `NewMappings`. Fix regression after f3b725b51c3d09882680ced5f71ab52c75ba9c2d GitOrigin-RevId: 35d6ea3c76a5d851d40fa28bfab9fc3c2b0ca828 --- platform/vcs-api/intellij.platform.vcs.iml | 1 + .../src/com/intellij/openapi/vcs/AbstractVcs.java | 10 ++++++---- .../openapi/vcs/impl/projectlevelman/NewMappings.java | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/vcs-api/intellij.platform.vcs.iml b/platform/vcs-api/intellij.platform.vcs.iml index 93f4ab864831..4664c63f4233 100644 --- a/platform/vcs-api/intellij.platform.vcs.iml +++ b/platform/vcs-api/intellij.platform.vcs.iml @@ -15,5 +15,6 @@ + \ No newline at end of file diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java index 870f2dac3d5e..f69336ab3d5c 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java @@ -22,10 +22,7 @@ import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ThreeState; import com.intellij.util.ui.VcsSynchronousProgressWrapper; -import org.jetbrains.annotations.CalledInAwt; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.*; import java.util.Collections; import java.util.List; @@ -428,6 +425,11 @@ public abstract class AbstractVcs extends S List convertRoots(@NotNull List result); } + @ApiStatus.Internal + public boolean needsLegacyDefaultMappings() { + return false; + } + /** * Returns the implementation of the merge provider which is used to load the revisions to be merged * for a particular file. diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java index 8dd8a8c20d24..494fbc7e92d9 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/NewMappings.java @@ -293,6 +293,8 @@ public class NewMappings implements Disposable { @NotNull Collection projectRoots, @NotNull Set mappedDirs) { try { + if (vcs.needsLegacyDefaultMappings()) return projectRoots; + DirectoryIndex directoryIndex = DirectoryIndex.getInstance(myProject); VcsRootChecker rootChecker = myVcsManager.getRootChecker(vcs);