Search in sources :

Example 1 with VcsHistoryProvider

use of com.intellij.openapi.vcs.history.VcsHistoryProvider in project intellij-community by JetBrains.

the class SvnProtocolsTest method testHistoryImpl.

private void testHistoryImpl(String s) throws VcsException {
    final VcsHistoryProvider provider = myVcs.getVcsHistoryProvider();
    final VcsAppendableHistoryPartnerAdapter partner = new VcsAppendableHistoryPartnerAdapter() {

        @Override
        public void acceptRevision(VcsFileRevision revision) {
            super.acceptRevision(revision);
            if (getSession().getRevisionList().size() > 1) {
                throw new ProcessCanceledException();
            }
        }
    };
    try {
        provider.reportAppendableHistory(VcsContextFactory.SERVICE.getInstance().createFilePathOnNonLocal(s, true), partner);
    } catch (ProcessCanceledException e) {
    //ok
    }
    final List<VcsFileRevision> list = partner.getSession().getRevisionList();
    Assert.assertTrue(!list.isEmpty());
}
Also used : VcsHistoryProvider(com.intellij.openapi.vcs.history.VcsHistoryProvider) VcsAppendableHistoryPartnerAdapter(com.intellij.openapi.vcs.history.VcsAppendableHistoryPartnerAdapter) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Example 2 with VcsHistoryProvider

use of com.intellij.openapi.vcs.history.VcsHistoryProvider in project intellij-community by JetBrains.

the class SvnHistoryTest method testRepositoryRootHistory.

@Test
public void testRepositoryRootHistory() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    myCnt = 0;
    final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider();
    final SubTree tree = new SubTree(myWorkingCopyDir);
    checkin();
    for (int i = 0; i < 10; i++) {
        VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n" + i);
        checkin();
    }
    final Semaphore semaphore = new Semaphore();
    semaphore.down();
    final FilePath rootPath = VcsContextFactory.SERVICE.getInstance().createFilePathOnNonLocal(myRepoUrl, true);
    provider.reportAppendableHistory(rootPath, new VcsAppendableHistorySessionPartner() {

        @Override
        public void reportCreatedEmptySession(VcsAbstractHistorySession session) {
        }

        @Override
        public void acceptRevision(VcsFileRevision revision) {
            ++myCnt;
            semaphore.up();
        }

        @Override
        public void reportException(VcsException exception) {
            throw new RuntimeException(exception);
        }

        @Override
        public void finished() {
        }

        @Override
        public void beforeRefresh() {
        }

        @Override
        public void forceRefresh() {
        }
    });
    semaphore.waitFor(1000);
    Assert.assertTrue(myCnt > 0);
}
Also used : VcsAppendableHistorySessionPartner(com.intellij.openapi.vcs.history.VcsAppendableHistorySessionPartner) VcsHistoryProvider(com.intellij.openapi.vcs.history.VcsHistoryProvider) Semaphore(com.intellij.util.concurrency.Semaphore) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision) VcsAbstractHistorySession(com.intellij.openapi.vcs.history.VcsAbstractHistorySession) Test(org.junit.Test)

Example 3 with VcsHistoryProvider

use of com.intellij.openapi.vcs.history.VcsHistoryProvider in project intellij-community by JetBrains.

the class SvnHistoryTest method testSimpleHistoryLocal.

@Test
public void testSimpleHistoryLocal() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    myCnt = 0;
    final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider();
    final SubTree tree = new SubTree(myWorkingCopyDir);
    checkin();
    for (int i = 0; i < 10; i++) {
        VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n" + i);
        checkin();
    }
    final Semaphore semaphore = new Semaphore();
    semaphore.down();
    provider.reportAppendableHistory(VcsUtil.getFilePath(tree.myS1File), new VcsAppendableHistorySessionPartner() {

        @Override
        public void reportCreatedEmptySession(VcsAbstractHistorySession session) {
        }

        @Override
        public void acceptRevision(VcsFileRevision revision) {
            ++myCnt;
        }

        @Override
        public void reportException(VcsException exception) {
            throw new RuntimeException(exception);
        }

        @Override
        public void finished() {
            semaphore.up();
        }

        @Override
        public void beforeRefresh() {
        }

        @Override
        public void forceRefresh() {
        }
    });
    semaphore.waitFor(1000);
    Assert.assertEquals(11, myCnt);
}
Also used : VcsAppendableHistorySessionPartner(com.intellij.openapi.vcs.history.VcsAppendableHistorySessionPartner) VcsHistoryProvider(com.intellij.openapi.vcs.history.VcsHistoryProvider) Semaphore(com.intellij.util.concurrency.Semaphore) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision) VcsAbstractHistorySession(com.intellij.openapi.vcs.history.VcsAbstractHistorySession) Test(org.junit.Test)

Example 4 with VcsHistoryProvider

use of com.intellij.openapi.vcs.history.VcsHistoryProvider in project intellij-community by JetBrains.

the class SvnHistoryTest method testSimpleHistory.

@Test
public void testSimpleHistory() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    myCnt = 0;
    final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider();
    final SubTree tree = new SubTree(myWorkingCopyDir);
    checkin();
    for (int i = 0; i < 10; i++) {
        VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n" + i);
        checkin();
    }
    final Semaphore semaphore = new Semaphore();
    semaphore.down();
    final FilePath rootPath = VcsContextFactory.SERVICE.getInstance().createFilePathOnNonLocal(myRepoUrl + "/root/source/s1.txt", true);
    provider.reportAppendableHistory(rootPath, new VcsAppendableHistorySessionPartner() {

        @Override
        public void reportCreatedEmptySession(VcsAbstractHistorySession session) {
        }

        @Override
        public void acceptRevision(VcsFileRevision revision) {
            ++myCnt;
        }

        @Override
        public void reportException(VcsException exception) {
            throw new RuntimeException(exception);
        }

        @Override
        public void finished() {
            semaphore.up();
        }

        @Override
        public void beforeRefresh() {
        }

        @Override
        public void forceRefresh() {
        }
    });
    semaphore.waitFor(1000);
    Assert.assertEquals(11, myCnt);
}
Also used : VcsAppendableHistorySessionPartner(com.intellij.openapi.vcs.history.VcsAppendableHistorySessionPartner) VcsHistoryProvider(com.intellij.openapi.vcs.history.VcsHistoryProvider) Semaphore(com.intellij.util.concurrency.Semaphore) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision) VcsAbstractHistorySession(com.intellij.openapi.vcs.history.VcsAbstractHistorySession) Test(org.junit.Test)

Example 5 with VcsHistoryProvider

use of com.intellij.openapi.vcs.history.VcsHistoryProvider in project intellij-community by JetBrains.

the class SvnHistoryTest method testLocallyRenamedFileHistory.

@Test
public void testLocallyRenamedFileHistory() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    myCnt = 0;
    final VcsHistoryProvider provider = SvnVcs.getInstance(myProject).getVcsHistoryProvider();
    final SubTree tree = new SubTree(myWorkingCopyDir);
    checkin();
    for (int i = 0; i < 10; i++) {
        VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n" + i);
        checkin();
    }
    VcsTestUtil.renameFileInCommand(myProject, tree.myS1File, "renamed.txt");
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    ChangeListManager.getInstance(myProject).ensureUpToDate(false);
    final Semaphore semaphore = new Semaphore();
    semaphore.down();
    provider.reportAppendableHistory(VcsUtil.getFilePath(tree.myS1File), new VcsAppendableHistorySessionPartner() {

        @Override
        public void reportCreatedEmptySession(VcsAbstractHistorySession session) {
        }

        @Override
        public void acceptRevision(VcsFileRevision revision) {
            ++myCnt;
        }

        @Override
        public void reportException(VcsException exception) {
            throw new RuntimeException(exception);
        }

        @Override
        public void finished() {
            semaphore.up();
        }

        @Override
        public void beforeRefresh() {
        }

        @Override
        public void forceRefresh() {
        }
    });
    semaphore.waitFor(1000);
    Assert.assertEquals(11, myCnt);
}
Also used : VcsAppendableHistorySessionPartner(com.intellij.openapi.vcs.history.VcsAppendableHistorySessionPartner) VcsHistoryProvider(com.intellij.openapi.vcs.history.VcsHistoryProvider) Semaphore(com.intellij.util.concurrency.Semaphore) VcsFileRevision(com.intellij.openapi.vcs.history.VcsFileRevision) VcsAbstractHistorySession(com.intellij.openapi.vcs.history.VcsAbstractHistorySession) Test(org.junit.Test)

Aggregations

VcsHistoryProvider (com.intellij.openapi.vcs.history.VcsHistoryProvider)12 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)8 VcsAbstractHistorySession (com.intellij.openapi.vcs.history.VcsAbstractHistorySession)5 VcsAppendableHistorySessionPartner (com.intellij.openapi.vcs.history.VcsAppendableHistorySessionPartner)5 Semaphore (com.intellij.util.concurrency.Semaphore)5 Test (org.junit.Test)5 Project (com.intellij.openapi.project.Project)4 AbstractVcs (com.intellij.openapi.vcs.AbstractVcs)3 VcsHistorySession (com.intellij.openapi.vcs.history.VcsHistorySession)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 VcsHistoryProviderEx (com.intellij.vcs.history.VcsHistoryProviderEx)2 VcsSelection (com.intellij.vcsUtil.VcsSelection)2 FileHyperlinkInfo (com.intellij.execution.filters.FileHyperlinkInfo)1 HyperlinkInfo (com.intellij.execution.filters.HyperlinkInfo)1 EditorHyperlinkSupport (com.intellij.execution.impl.EditorHyperlinkSupport)1 AllIcons (com.intellij.icons.AllIcons)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 Logger (com.intellij.openapi.diagnostic.Logger)1