diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryContentRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryContentRevision.java index 836f6b4c83b1..459e9ab3a30e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryContentRevision.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryContentRevision.java @@ -40,6 +40,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnBundle; import org.jetbrains.idea.svn.SvnRevisionNumber; +import org.jetbrains.idea.svn.SvnUtil; import org.jetbrains.idea.svn.SvnVcs; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.io.SVNRepository; @@ -65,7 +66,16 @@ public class SvnRepositoryContentRevision implements ContentRevision, MarkerVcsC myFilePath = localPath; } else { - myFilePath = VcsContextFactory.SERVICE.getInstance().createFilePathOnNonLocal(myPath, false); + FilePath local; + try { + final String fullPath = SvnUtil.appendMultiParts(repositoryRoot, myPath); + local = VcsContextFactory.SERVICE.getInstance().createFilePathOnNonLocal(fullPath, false); + } + catch (SVNException e) { + // todo what to do safely? + local = VcsContextFactory.SERVICE.getInstance().createFilePathOnNonLocal(repositoryRoot, false); + } + myFilePath = local; } myRevision = revision; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocation.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocation.java index 3d5bcaf0d92b..0366c21ea202 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocation.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocation.java @@ -16,12 +16,18 @@ package org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.FilePath; +import com.intellij.openapi.vcs.ProjectLevelVcsManager; import com.intellij.openapi.vcs.RepositoryLocation; import com.intellij.openapi.vcs.VcsException; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.NotNullFunction; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.RootUrlInfo; +import org.jetbrains.idea.svn.SvnUtil; import org.jetbrains.idea.svn.SvnVcs; +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNURL; +import org.tmatesoft.svn.core.internal.util.SVNURLUtil; import java.io.File; @@ -62,9 +68,26 @@ public class SvnRepositoryLocation implements RepositoryLocation { @Nullable public static FilePath getLocalPath(final String fullPath, final NotNullFunction detector, final SvnVcs vcs) { if (vcs.getProject().isDefault()) return null; + final SVNURL fullPathURL; + try { + fullPathURL = SVNURL.parseURIEncoded(fullPath); + } + catch (SVNException e) { + return null; + } final RootUrlInfo rootForUrl = vcs.getSvnFileUrlMapping().getWcRootForUrl(fullPath); if (rootForUrl != null) { return LocationDetector.filePathByUrlAndPath(fullPath, rootForUrl.getUrl().toString(), rootForUrl.getIoFile().getAbsolutePath(), detector); + } else { + final VirtualFile[] underVcs = ProjectLevelVcsManager.getInstance(vcs.getProject()).getRootsUnderVcs(vcs); + if (underVcs.length == 0) return null; + for (VirtualFile vf : underVcs) { + final File ioFile = new File(vf.getPath()); + final SVNURL url = SvnUtil.getUrl(vcs, ioFile); + if (url != null && SVNURLUtil.isAncestor(url, fullPathURL)) { + return LocationDetector.filePathByUrlAndPath(fullPath, url.toString(), ioFile.getPath(), detector); + } + } } return null;