use of com.intellij.openapi.vcs.annotate.FileAnnotation in project intellij-community by JetBrains.
the class HgAnnotationTest method checkAnnotation.
private void checkAnnotation(String name, String revisionNum, String expectedContent) throws VcsException {
FileAnnotation fileAnnotation = myHgAnnotationProvider.annotate(VcsUtil.getFilePath(new File(myRepository.getPath(), name)), HgRevisionNumber.getInstance(revisionNum, revisionNum));
final HgRevisionNumber actualRevisionNumber = (HgRevisionNumber) fileAnnotation.getLineRevisionNumber(0);
assert actualRevisionNumber != null;
assertEquals(revisionNum, actualRevisionNumber.getRevision());
assertEquals(expectedContent, fileAnnotation.getAnnotatedContent());
}
use of com.intellij.openapi.vcs.annotate.FileAnnotation in project intellij-community by JetBrains.
the class SvnAnnotationIsClosedTest method testClosedByExternalUpdate.
@Test
public void testClosedByExternalUpdate() throws Exception {
final SubTree tree = new SubTree(myWorkingCopyDir);
//#1
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n");
//#2
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n");
//#3
checkin();
// take #2
runInAndVerifyIgnoreOutput("up", "-r", "2");
final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File);
annotation.setCloser(() -> {
myIsClosed = true;
listener.unregisterAnnotation(tree.myS1File, annotation);
});
listener.registerAnnotation(tree.myS1File, annotation);
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1+\n2\n3\n4\n");
myDirtyScopeManager.markEverythingDirty();
myChangeListManager.ensureUpToDate(false);
Assert.assertFalse(myIsClosed);
update();
myWorkingCopyDir.refresh(false, true);
imitateEvent(myWorkingCopyDir);
myChangeListManager.ensureUpToDate(false);
// wait for after-events like annotations recalculation
myChangeListManager.ensureUpToDate(false);
// zipper updater
sleep(100);
Assert.assertTrue(myIsClosed);
}
use of com.intellij.openapi.vcs.annotate.FileAnnotation in project intellij-community by JetBrains.
the class SvnAnnotationIsClosedTest method testAnnotateRenamed.
@Test
public void testAnnotateRenamed() throws Exception {
final SubTree tree = new SubTree(myWorkingCopyDir);
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n");
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n");
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4++\n");
final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File);
annotation.setCloser(() -> {
myIsClosed = true;
listener.unregisterAnnotation(tree.myS1File, annotation);
});
listener.registerAnnotation(tree.myS1File, annotation);
// not closed on typing
Assert.assertFalse(myIsClosed);
myDirtyScopeManager.markEverythingDirty();
myChangeListManager.ensureUpToDate(false);
final Change change = myChangeListManager.getChange(tree.myS1File);
Assert.assertNotNull(change);
}
use of com.intellij.openapi.vcs.annotate.FileAnnotation in project intellij-community by JetBrains.
the class SvnAnnotationIsClosedTest method testClosedChangedByUpdateInIdea.
@Test
public void testClosedChangedByUpdateInIdea() throws Exception {
final SubTree tree = new SubTree(myWorkingCopyDir);
//#1
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n");
//#2
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n");
//#3
checkin();
// take #2
runInAndVerifyIgnoreOutput("up", "-r", "2");
final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File);
annotation.setCloser(() -> {
myIsClosed = true;
listener.unregisterAnnotation(tree.myS1File, annotation);
});
listener.registerAnnotation(tree.myS1File, annotation);
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1+\n2\n3\n4\n");
myDirtyScopeManager.markEverythingDirty();
myChangeListManager.ensureUpToDate(false);
Assert.assertFalse(myIsClosed);
imitUpdate(myProject);
Assert.assertTrue(myIsClosed);
}
use of com.intellij.openapi.vcs.annotate.FileAnnotation in project intellij-community by JetBrains.
the class SvnAnnotationIsClosedTest method testClosedByExternalCommit.
@Test
public void testClosedByExternalCommit() throws Exception {
final SubTree tree = new SubTree(myWorkingCopyDir);
//#1
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n");
//#2
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n");
//#3
checkin();
final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File);
annotation.setCloser(() -> {
myIsClosed = true;
listener.unregisterAnnotation(tree.myS1File, annotation);
});
listener.registerAnnotation(tree.myS1File, annotation);
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1+\n2\n3\n4\n");
myDirtyScopeManager.markEverythingDirty();
myChangeListManager.ensureUpToDate(false);
Assert.assertFalse(myIsClosed);
checkin();
myWorkingCopyDir.refresh(false, true);
imitateEvent(myWorkingCopyDir);
myChangeListManager.ensureUpToDate(false);
// wait for after-events like annotations recalculation
myChangeListManager.ensureUpToDate(false);
// zipper updater
sleep(100);
Assert.assertTrue(myIsClosed);
}
Aggregations