Search in sources :

Example 1 with SvnFileUrlMapping

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

the class SvnExternalCommitNoticedTest method testExternalRootSwitch.

@Test
public void testExternalRootSwitch() throws Exception {
    final String branchUrl = prepareBranchesStructure();
    final SubTree tree = new SubTree(myWorkingCopyDir);
    myVcs.invokeRefreshSvnRoots();
    clManager.ensureUpToDate(false);
    clManager.ensureUpToDate(false);
    SvnFileUrlMapping workingCopies = myVcs.getSvnFileUrlMapping();
    List<RootUrlInfo> infos = workingCopies.getAllWcInfos();
    Assert.assertEquals(1, infos.size());
    Assert.assertEquals(myRepoUrl + "/trunk", infos.get(0).getAbsoluteUrl());
    runInAndVerifyIgnoreOutput("switch", branchUrl, myWorkingCopyDir.getPath());
    myWorkingCopyDir.refresh(false, true);
    imitateEvent(myWorkingCopyDir);
    sleep(300);
    // no dirty scope externally provided! just VFS refresh
    clManager.ensureUpToDate(false);
    //first run queries one more update
    clManager.ensureUpToDate(false);
    workingCopies = myVcs.getSvnFileUrlMapping();
    infos = workingCopies.getAllWcInfos();
    Assert.assertEquals(1, infos.size());
    Assert.assertEquals(branchUrl, infos.get(0).getAbsoluteUrl());
}
Also used : SvnFileUrlMapping(org.jetbrains.idea.svn.SvnFileUrlMapping) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) Test(org.junit.Test)

Example 2 with SvnFileUrlMapping

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

the class UpdateEventHandler method itemSwitched.

private boolean itemSwitched(final ProgressEvent event) {
    final File file = event.getFile();
    final SvnFileUrlMapping urlMapping = myVCS.getSvnFileUrlMapping();
    final SVNURL currentUrl = urlMapping.getUrlForFile(file);
    return (currentUrl != null) && (!currentUrl.equals(event.getURL()));
}
Also used : SvnFileUrlMapping(org.jetbrains.idea.svn.SvnFileUrlMapping) SVNURL(org.tmatesoft.svn.core.SVNURL) File(java.io.File)

Example 3 with SvnFileUrlMapping

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

the class SvnCopyPathTracker method getFilePath.

@Nullable
public FilePath getFilePath(final SvnVcs vcs) {
    if (!myHadChanged)
        return null;
    final SvnFileUrlMapping svnFileUrlMapping = vcs.getSvnFileUrlMapping();
    final String absolutePath = SVNPathUtil.append(myRepositoryRoot, myCurrentPath);
    final File localPath = svnFileUrlMapping.getLocalPath(absolutePath);
    if (localPath == null) {
        LOG.info("Cannot find local path for url: " + absolutePath);
        return null;
    }
    return VcsUtil.getFilePath(localPath, false);
}
Also used : SvnFileUrlMapping(org.jetbrains.idea.svn.SvnFileUrlMapping) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with SvnFileUrlMapping

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

the class LatestExistentSearcher method detectStartRevision.

private boolean detectStartRevision() {
    if (!myStartExistsKnown) {
        final SvnFileUrlMapping mapping = myVcs.getSvnFileUrlMapping();
        final RootUrlInfo rootUrlInfo = mapping.getWcRootForUrl(myUrl.toString());
        if (rootUrlInfo == null)
            return true;
        final VirtualFile vf = rootUrlInfo.getVirtualFile();
        final Info info = myVcs.getInfo(vf);
        if ((info == null) || (info.getRevision() == null)) {
            return false;
        }
        myStartNumber = info.getRevision().getNumber();
        myStartExistsKnown = true;
    }
    return true;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SvnFileUrlMapping(org.jetbrains.idea.svn.SvnFileUrlMapping) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) Info(org.jetbrains.idea.svn.info.Info)

Example 5 with SvnFileUrlMapping

use of org.jetbrains.idea.svn.SvnFileUrlMapping 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

SvnFileUrlMapping (org.jetbrains.idea.svn.SvnFileUrlMapping)5 RootUrlInfo (org.jetbrains.idea.svn.RootUrlInfo)3 File (java.io.File)2 SVNURL (org.tmatesoft.svn.core.SVNURL)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Nullable (org.jetbrains.annotations.Nullable)1 Info (org.jetbrains.idea.svn.info.Info)1 Test (org.junit.Test)1