use of com.intellij.openapi.vcs.VcsRoot in project intellij-community by JetBrains.
the class VcsRootDetectorImpl method detect.
@NotNull
public Collection<VcsRoot> detect(@Nullable VirtualFile startDir) {
if (startDir == null || myCheckers.length == 0) {
return Collections.emptyList();
}
final Set<VcsRoot> roots = scanForRootsInsideDir(startDir);
roots.addAll(scanForRootsInContentRoots());
for (VcsRoot root : roots) {
if (startDir.equals(root.getPath())) {
return roots;
}
}
List<VcsRoot> rootsAbove = scanForSingleRootAboveDir(startDir);
roots.addAll(rootsAbove);
return roots;
}
use of com.intellij.openapi.vcs.VcsRoot in project intellij-community by JetBrains.
the class VcsLogFileHistoryProviderImpl method canShowFileHistory.
@Override
public boolean canShowFileHistory(@NotNull Project project, @NotNull FilePath path) {
if (!Registry.is("vcs.new.history"))
return false;
VcsRoot rootObject = ProjectLevelVcsManager.getInstance(project).getVcsRootObjectFor(path);
if (rootObject == null)
return false;
VirtualFile root = rootObject.getPath();
AbstractVcs vcs = rootObject.getVcs();
if (vcs == null || root == null)
return false;
VcsLogData dataManager = VcsProjectLog.getInstance(project).getDataManager();
if (dataManager == null || !dataManager.getRoots().contains(root) || dataManager.getIndex().getDataGetter() == null)
return false;
List<VcsLogProvider> allLogProviders = Arrays.asList(Extensions.getExtensions(VcsLogProvider.LOG_PROVIDER_EP, project));
VcsLogProvider provider = ContainerUtil.find(allLogProviders, p -> p.getSupportedVcs().equals(vcs.getKeyInstanceMethod()));
if (provider == null)
return false;
return VcsLogProperties.get(provider, VcsLogProperties.SUPPORTS_INDEXING);
}
Aggregations