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));
}
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;
}
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;
}
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);
}
}
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);
}
Aggregations