use of org.zmlx.hg4idea.provider.HgDiffProvider in project intellij-community by JetBrains.
the class HgDiffProviderTest method shouldFindCurrentRevisionForRenamedFile.
@Test
public void shouldFindCurrentRevisionForRenamedFile() throws Exception {
fillFile(myProjectDir, new String[] { AFILE }, INITIAL_FILE_CONTENT);
addAll();
commitAll("initial content");
fillFile(myProjectDir, new String[] { AFILE }, UPDATED_FILE_CONTENT);
commitAll("updated content");
runHgOnProjectRepo("rename", AFILE, BFILE);
//don't commit
refreshVfs();
ChangeListManager.getInstance(myProject).ensureUpToDate(false);
HgDiffProvider diffProvider = new HgDiffProvider(myProject);
VirtualFile child = myWorkingCopyDir.findChild(BFILE);
ContentRevision fileContent = diffProvider.createFileContent(diffProvider.getCurrentRevision(child), child);
assertNotNull(fileContent);
assertEquals(fileContent.getContent(), UPDATED_FILE_CONTENT);
}
use of org.zmlx.hg4idea.provider.HgDiffProvider in project intellij-community by JetBrains.
the class HgDiffProviderTest method currentRevisionShouldBeTheRevisionInWhichTheFileLastChanged.
@Test
public void currentRevisionShouldBeTheRevisionInWhichTheFileLastChanged() throws Exception {
fillFile(myProjectDir, new String[] { AFILE }, INITIAL_FILE_CONTENT);
addAll();
commitAll("initial content");
fillFile(myProjectDir, new String[] { AFILE }, UPDATED_FILE_CONTENT);
commitAll("updated content");
fillFile(myProjectDir, new String[] { BFILE }, INITIAL_FILE_CONTENT);
commitAll("added new file");
refreshVfs();
HgDiffProvider diffProvider = new HgDiffProvider(myProject);
HgRevisionNumber currentRevision = (HgRevisionNumber) diffProvider.getCurrentRevision(myWorkingCopyDir.findChild(AFILE));
assertNotNull(currentRevision, "The current revision for AFILE should be found");
assertEquals(currentRevision.getRevision(), "1", "The diff provider should return the revision in which AFILE was last changed");
}
Aggregations