Search in sources :

Example 21 with SvnVcs

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

the class SvnCheckoutProvider method notifyRootManagerIfUnderProject.

private static void notifyRootManagerIfUnderProject(final Project project, final File directory) {
    if (project.isDefault())
        return;
    final ProjectLevelVcsManagerEx plVcsManager = ProjectLevelVcsManagerEx.getInstanceEx(project);
    final SvnVcs vcs = (SvnVcs) plVcsManager.findVcsByName(SvnVcs.VCS_NAME);
    final VirtualFile[] files = vcs.getSvnFileUrlMapping().getNotFilteredRoots();
    for (VirtualFile file : files) {
        if (FileUtil.isAncestor(virtualToIoFile(file), directory, false)) {
            // todo: should be done like auto detection
            plVcsManager.fireDirectoryMappingsChanged();
            return;
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) SvnVcs(org.jetbrains.idea.svn.SvnVcs)

Example 22 with SvnVcs

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

the class SvnCommittedViewTest method testCopyDir.

@Test
public void testCopyDir() throws Exception {
    final File trunk = new File(myTempDirFixture.getTempDirPath(), "trunk");
    trunk.mkdir();
    Thread.sleep(100);
    final File folder = new File(trunk, "folder");
    folder.mkdir();
    Thread.sleep(100);
    new File(folder, "f1.txt").createNewFile();
    new File(folder, "f2.txt").createNewFile();
    Thread.sleep(100);
    runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk");
    runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch");
    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    vcs.invokeRefreshSvnRoots();
    final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
    final List<SvnChangeList> changeListList = committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(), new SvnRepositoryLocation(myRepoUrl + "/branch"), 0);
    checkList(changeListList, 2, new Data[] { new Data(new File(myWorkingCopyDir.getPath(), "branch").getAbsolutePath(), FileStatus.ADDED, "- copied from /trunk") });
}
Also used : SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Test(org.junit.Test)

Example 23 with SvnVcs

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

the class SvnCommittedViewTest method testCopyAndModify.

@Test
public void testCopyAndModify() throws Exception {
    final File trunk = new File(myTempDirFixture.getTempDirPath(), "trunk");
    trunk.mkdir();
    Thread.sleep(100);
    final File folder = new File(trunk, "folder");
    folder.mkdir();
    Thread.sleep(100);
    new File(folder, "f1.txt").createNewFile();
    new File(folder, "f2.txt").createNewFile();
    Thread.sleep(100);
    runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk");
    update();
    runInAndVerifyIgnoreOutput("copy", myWorkingCopyDir.getPath() + "/trunk", myWorkingCopyDir.getPath() + "/branch");
    runInAndVerifyIgnoreOutput("propset", "testprop", "testval", myWorkingCopyDir.getPath() + "/branch/folder");
    checkin();
    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    vcs.invokeRefreshSvnRoots();
    final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
    final List<SvnChangeList> changeListList = committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(), new SvnRepositoryLocation(myRepoUrl + "/branch"), 0);
    checkList(changeListList, 2, new Data[] { new Data(new File(myWorkingCopyDir.getPath(), "branch").getAbsolutePath(), FileStatus.ADDED, "- copied from /trunk"), new Data(new File(myWorkingCopyDir.getPath(), "branch/folder").getAbsolutePath(), FileStatus.MODIFIED, "- copied from /trunk/folder") });
}
Also used : SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Test(org.junit.Test)

Example 24 with SvnVcs

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

the class SvnCommittedViewTest method testMoveDir.

@Test
public void testMoveDir() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");
    VirtualFile d2 = createDirInCommand(myWorkingCopyDir, "d2");
    VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
    VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");
    // r1, addition without history
    checkin();
    final String oldPath = absPath(d1);
    moveFileInCommand(d1, d2);
    Thread.sleep(100);
    checkin();
    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    vcs.invokeRefreshSvnRoots();
    final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
    final List<SvnChangeList> changeListList = committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(), new SvnRepositoryLocation(myRepoUrl), 0);
    checkList(changeListList, 2, new Data[] { new Data(absPath(d1), FileStatus.MODIFIED, "- moved from .." + File.separatorChar + "d1") });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Test(org.junit.Test)

Example 25 with SvnVcs

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

the class SvnMergeProvider method isBinary.

public boolean isBinary(@NotNull final VirtualFile file) {
    SvnVcs vcs = SvnVcs.getInstance(myProject);
    try {
        File ioFile = virtualToIoFile(file);
        PropertyClient client = vcs.getFactory(ioFile).createPropertyClient();
        PropertyValue value = client.getProperty(SvnTarget.fromFile(ioFile), SvnPropertyKeys.SVN_MIME_TYPE, false, SVNRevision.WORKING);
        if (value != null && isBinaryMimeType(value.toString())) {
            return true;
        }
    } catch (VcsException e) {
        LOG.warn(e);
    }
    return false;
}
Also used : PropertyClient(org.jetbrains.idea.svn.properties.PropertyClient) VcsException(com.intellij.openapi.vcs.VcsException) PropertyValue(org.jetbrains.idea.svn.properties.PropertyValue) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File) SvnVcs(org.jetbrains.idea.svn.SvnVcs)

Aggregations

SvnVcs (org.jetbrains.idea.svn.SvnVcs)31 VirtualFile (com.intellij.openapi.vfs.VirtualFile)20 File (java.io.File)9 VcsException (com.intellij.openapi.vcs.VcsException)8 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)8 ChangeBrowserSettings (com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)7 SvnChangeList (org.jetbrains.idea.svn.history.SvnChangeList)7 SvnRepositoryLocation (org.jetbrains.idea.svn.history.SvnRepositoryLocation)7 Test (org.junit.Test)7 Project (com.intellij.openapi.project.Project)5 NotNull (org.jetbrains.annotations.NotNull)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 Ref (com.intellij.openapi.util.Ref)3 RootUrlInfo (org.jetbrains.idea.svn.RootUrlInfo)2 ProgressTracker (org.jetbrains.idea.svn.api.ProgressTracker)2 Info (org.jetbrains.idea.svn.info.Info)2 SVNException (org.tmatesoft.svn.core.SVNException)2 SVNURL (org.tmatesoft.svn.core.SVNURL)2 LocalHistoryAction (com.intellij.history.LocalHistoryAction)1 UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)1