Search in sources :

Example 11 with SvnVcs

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

the class IgnoreActionGroup method update.

public void update(final AnActionEvent e) {
    final FileGroupInfo fileGroupInfo = new FileGroupInfo();
    myHelperAction.setFileIterationListener(fileGroupInfo);
    myHelperAction.update(e);
    myGetterStub.setDelegate(fileGroupInfo);
    if ((e.getPresentation().isEnabled())) {
        removeAll();
        if (myHelperAction.allAreIgnored()) {
            final DataContext dataContext = e.getDataContext();
            final Project project = CommonDataKeys.PROJECT.getData(dataContext);
            SvnVcs vcs = SvnVcs.getInstance(project);
            final Ref<Boolean> filesOk = new Ref<>(Boolean.FALSE);
            final Ref<Boolean> extensionOk = new Ref<>(Boolean.FALSE);
            // virtual files parameter is not used -> can pass null
            SvnPropertyService.doCheckIgnoreProperty(vcs, null, fileGroupInfo, fileGroupInfo.getExtensionMask(), filesOk, extensionOk);
            if (Boolean.TRUE.equals(filesOk.get())) {
                myRemoveExactAction.setActionText(fileGroupInfo.oneFileSelected() ? fileGroupInfo.getFileName() : SvnBundle.message("action.Subversion.UndoIgnore.text"));
                add(myRemoveExactAction);
            }
            if (Boolean.TRUE.equals(extensionOk.get())) {
                myRemoveExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
                add(myRemoveExtensionAction);
            }
            e.getPresentation().setText(SvnBundle.message("group.RevertIgnoreChoicesGroup.text"));
        } else if (myHelperAction.allCanBeIgnored()) {
            final String ignoreExactlyName = (fileGroupInfo.oneFileSelected()) ? fileGroupInfo.getFileName() : SvnBundle.message("action.Subversion.Ignore.ExactMatch.text");
            myAddExactAction.setActionText(ignoreExactlyName);
            add(myAddExactAction);
            if (fileGroupInfo.sameExtension()) {
                myAddExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
                add(myAddExtensionAction);
            }
            e.getPresentation().setText(SvnBundle.message("group.IgnoreChoicesGroup.text"));
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) Ref(com.intellij.openapi.util.Ref) FileGroupInfo(org.jetbrains.idea.svn.ignore.FileGroupInfo) SvnVcs(org.jetbrains.idea.svn.SvnVcs)

Example 12 with SvnVcs

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

the class SvnMergeInfoTest method assertMergeInfo.

private void assertMergeInfo(@NotNull File file, @NotNull String... values) throws SVNException {
    // TODO: Replace with ClientFactory model
    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    final SVNWCClient wcClient = vcs.getSvnKitManager().createWCClient();
    final SVNPropertyData data = wcClient.doGetProperty(file, "svn:mergeinfo", SVNRevision.UNDEFINED, SVNRevision.WORKING);
    assert data != null && data.getValue() != null;
    boolean result = false;
    for (String value : values) {
        result |= value.equals(data.getValue().getString());
    }
    assert result;
}
Also used : SVNPropertyData(org.tmatesoft.svn.core.wc.SVNPropertyData) SVNWCClient(org.tmatesoft.svn.core.wc.SVNWCClient) SvnVcs(org.jetbrains.idea.svn.SvnVcs)

Example 13 with SvnVcs

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

the class SvnCommittedViewTest method testAdd.

@Test
public void testAdd() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    final VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");
    final VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
    final VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");
    // r1, addition without history
    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, 1, new Data[] { new Data(absPath(f11), FileStatus.ADDED, null), new Data(absPath(f12), FileStatus.ADDED, null), new Data(absPath(d1), FileStatus.ADDED, null) });
}
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 14 with SvnVcs

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

the class SvnCommittedViewTest method testReplaced.

@Test
public void testReplaced() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");
    VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
    VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");
    // r1, addition without history
    checkin();
    final String d1Path = virtualToIoFile(d1).getAbsolutePath();
    runInAndVerifyIgnoreOutput("delete", d1Path);
    runInAndVerifyIgnoreOutput("add", d1Path);
    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, "- replaced") });
}
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 15 with SvnVcs

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

the class SvnCommittedViewTest method testMoveDirChangeFile.

@Test
public void testMoveDirChangeFile() 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);
    final String oldF11Path = virtualToIoFile(f11).getAbsolutePath();
    moveFileInCommand(d1, d2);
    VcsTestUtil.editFileInCommand(myProject, f11, "new");
    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"), new Data(absPath(f11), FileStatus.MODIFIED, "- moved from " + oldF11Path) });
}
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)

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