Search in sources :

Example 16 with VcsRoot

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;
}
Also used : VcsRoot(com.intellij.openapi.vcs.VcsRoot) NotNull(org.jetbrains.annotations.NotNull)

Example 17 with VcsRoot

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);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsLogData(com.intellij.vcs.log.data.VcsLogData) VcsLogProvider(com.intellij.vcs.log.VcsLogProvider) VcsRoot(com.intellij.openapi.vcs.VcsRoot) AbstractVcs(com.intellij.openapi.vcs.AbstractVcs)

Aggregations

VcsRoot (com.intellij.openapi.vcs.VcsRoot)17 VirtualFile (com.intellij.openapi.vfs.VirtualFile)12 NotNull (org.jetbrains.annotations.NotNull)8 AbstractVcs (com.intellij.openapi.vcs.AbstractVcs)7 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)3 Disposable (com.intellij.openapi.Disposable)2 Project (com.intellij.openapi.project.Project)2 ProjectLevelVcsManager (com.intellij.openapi.vcs.ProjectLevelVcsManager)2 VcsLogProvider (com.intellij.vcs.log.VcsLogProvider)2 File (java.io.File)2 Nullable (org.jetbrains.annotations.Nullable)2 AdditionalOptionsPanel (com.intellij.cvsSupport2.checkinProject.AdditionalOptionsPanel)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)1 ServiceManager (com.intellij.openapi.components.ServiceManager)1 FileChooser (com.intellij.openapi.fileChooser.FileChooser)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1