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());
}
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);
}
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);
}
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);
}
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);
}
Aggregations