use of com.intellij.openapi.vcs.history.VcsAbstractHistorySession 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.VcsAbstractHistorySession 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.VcsAbstractHistorySession 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.VcsAbstractHistorySession 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);
}
use of com.intellij.openapi.vcs.history.VcsAbstractHistorySession in project intellij-community by JetBrains.
the class SvnHistoryTest method testLocallyMovedToRenamedDirectory.
@Test
public void testLocallyMovedToRenamedDirectory() 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.myTargetDir, "renamedTarget");
VcsTestUtil.moveFileInCommand(myProject, tree.myS1File, tree.myTargetDir);
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);
myCnt = 0;
semaphore.down();
provider.reportAppendableHistory(VcsUtil.getFilePath(tree.myTargetDir), 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(1, myCnt);
myCnt = 0;
semaphore.down();
provider.reportAppendableHistory(VcsUtil.getFilePath(tree.myTargetFiles.get(0)), 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(1, myCnt);
}
Aggregations