Search in sources :

Example 6 with RootUrlInfo

use of org.jetbrains.idea.svn.RootUrlInfo in project intellij-community by JetBrains.

the class SvnWorkingCopyFormatUsagesCollector method getProjectUsages.

@NotNull
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) {
    SvnVcs vcs = SvnVcs.getInstance(project);
    // do not track roots with errors (SvnFileUrlMapping.getErrorRoots()) as they are "not usable" until errors are resolved
    // skip externals and switched directories as they will have the same format
    List<RootUrlInfo> roots = ContainerUtil.filter(vcs.getSvnFileUrlMapping().getAllWcInfos(), info -> info.getType() == null || NestedCopyType.inner.equals(info.getType()));
    return ContainerUtil.map2Set(roots, info -> new UsageDescriptor(info.getFormat().toString(), 1));
}
Also used : RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) SvnVcs(org.jetbrains.idea.svn.SvnVcs) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with RootUrlInfo

use of org.jetbrains.idea.svn.RootUrlInfo in project intellij-community by JetBrains.

the class SvnRepositoryLocation method getLocalPath.

@Nullable
public static FilePath getLocalPath(final String fullPath, final NotNullFunction<File, Boolean> detector, final SvnVcs vcs) {
    if (vcs.getProject().isDefault())
        return null;
    final RootUrlInfo rootForUrl = vcs.getSvnFileUrlMapping().getWcRootForUrl(fullPath);
    FilePath result = null;
    if (rootForUrl != null) {
        String relativePath = SvnUtil.getRelativeUrl(rootForUrl.getUrl(), fullPath);
        File file = new File(rootForUrl.getPath(), relativePath);
        VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);
        result = virtualFile != null ? VcsUtil.getFilePath(virtualFile) : VcsUtil.getFilePath(file, detector.fun(file).booleanValue());
    }
    return result;
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) VirtualFile(com.intellij.openapi.vfs.VirtualFile) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Example 8 with RootUrlInfo

use of org.jetbrains.idea.svn.RootUrlInfo in project intellij-community by JetBrains.

the class WcInfoLoader method reloadInfo.

@Nullable
public WCInfoWithBranches reloadInfo(@NotNull WCInfoWithBranches info) {
    File file = info.getRootInfo().getIoFile();
    RootUrlInfo rootInfo = myVcs.getSvnFileUrlMapping().getWcRootForFilePath(file);
    return rootInfo != null ? createInfo(new WCInfo(rootInfo, SvnUtil.isWorkingCopyRoot(file), SvnUtil.getDepth(myVcs, file))) : null;
}
Also used : WCInfo(org.jetbrains.idea.svn.dialogs.WCInfo) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Example 9 with RootUrlInfo

use of org.jetbrains.idea.svn.RootUrlInfo in project intellij-community by JetBrains.

the class BranchConfigurationDialog method configureBranches.

public static void configureBranches(@NotNull Project project, @Nullable VirtualFile file) {
    if (file == null) {
        return;
    }
    RootUrlInfo wcRoot = SvnVcs.getInstance(project).getSvnFileUrlMapping().getWcRootForFilePath(virtualToIoFile(file));
    if (wcRoot == null) {
        return;
    }
    SvnBranchConfigurationNew configuration = SvnBranchConfigurationManager.getInstance(project).get(file);
    SvnBranchConfigurationNew clonedConfiguration = configuration.copy();
    if (new BranchConfigurationDialog(project, clonedConfiguration, wcRoot.getRepositoryUrlUrl(), file, wcRoot.getUrl()).showAndGet()) {
        SvnBranchConfigurationManager.getInstance(project).setConfiguration(file, clonedConfiguration);
    }
}
Also used : RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo)

Example 10 with RootUrlInfo

use of org.jetbrains.idea.svn.RootUrlInfo in project intellij-community by JetBrains.

the class SelectBranchPopup method show.

public static void show(Project project, VirtualFile file, BranchSelectedCallback callback, final String title, final Component component) {
    final SvnFileUrlMapping urlMapping = SvnVcs.getInstance(project).getSvnFileUrlMapping();
    final SVNURL svnurl = urlMapping.getUrlForFile(virtualToIoFile(file));
    if (svnurl == null) {
        return;
    }
    final RootUrlInfo rootUrlInfo = urlMapping.getWcRootForUrl(svnurl.toString());
    if (rootUrlInfo == null) {
        return;
    }
    // not vcs root but wc root is ok
    showForBranchRoot(project, rootUrlInfo.getVirtualFile(), callback, title, component);
}
Also used : SvnFileUrlMapping(org.jetbrains.idea.svn.SvnFileUrlMapping) SVNURL(org.tmatesoft.svn.core.SVNURL) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo)

Aggregations

RootUrlInfo (org.jetbrains.idea.svn.RootUrlInfo)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 File (java.io.File)3 Nullable (org.jetbrains.annotations.Nullable)3 SvnFileUrlMapping (org.jetbrains.idea.svn.SvnFileUrlMapping)3 WCInfo (org.jetbrains.idea.svn.dialogs.WCInfo)2 UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)1 FilePath (com.intellij.openapi.vcs.FilePath)1 NotNull (org.jetbrains.annotations.NotNull)1 Node (org.jetbrains.idea.svn.Node)1 SvnVcs (org.jetbrains.idea.svn.SvnVcs)1 WCInfoWithBranches (org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)1 Info (org.jetbrains.idea.svn.info.Info)1 MergeContext (org.jetbrains.idea.svn.integrate.MergeContext)1 BranchInfo (org.jetbrains.idea.svn.mergeinfo.BranchInfo)1 OneShotMergeInfoHelper (org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper)1 Test (org.junit.Test)1 SVNURL (org.tmatesoft.svn.core.SVNURL)1