本文整理汇总了Java中com.intellij.openapi.vcs.history.VcsFileRevision.loadContent方法的典型用法代码示例。如果您正苦于以下问题:Java VcsFileRevision.loadContent方法的具体用法?Java VcsFileRevision.loadContent怎么用?Java VcsFileRevision.loadContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vcs.history.VcsFileRevision
的用法示例。
在下文中一共展示了VcsFileRevision.loadContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCurrentAndPreviousRevisions
import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
/**
* 1. Make two versions of a file (create, add, commit, modify, commit).
* 2. Get the revisions history.
* 3. Verify versions' contents and the current version.
*/
@Test
public void testCurrentAndPreviousRevisions() throws Exception {
int versions = 0;
fillFile(myProjectDir, new String[]{ AFILE }, INITIAL_FILE_CONTENT);
addAll();
commitAll("initial content");
versions++;
fillFile(myProjectDir, new String[] { AFILE} , UPDATED_FILE_CONTENT);
commitAll("updated content");
versions++;
final VcsHistorySession session = getHistorySession(AFILE);
final List<VcsFileRevision> revisions = session.getRevisionList();
for (VcsFileRevision rev : revisions) {
rev.loadContent();
}
assertEquals(revisions.size(), versions);
assertTrue(session.isCurrentRevision(revisions.get(0).getRevisionNumber()));
assertEquals(revisions.get(0).getContent(), UPDATED_FILE_CONTENT.getBytes());
assertEquals(revisions.get(1).getContent(), INITIAL_FILE_CONTENT.getBytes());
}
示例2: locallyRenamedFileShouldGetHistory
import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
@Test
public void locallyRenamedFileShouldGetHistory() throws Exception {
int versions = 0;
fillFile(myProjectDir, new String[]{ AFILE }, INITIAL_FILE_CONTENT);
addAll();
commitAll("initial content");
versions++;
fillFile(myProjectDir, new String[]{AFILE}, UPDATED_FILE_CONTENT);
commitAll("updated content");
versions++;
runHgOnProjectRepo("rename", AFILE, BFILE);
//don't commit
refreshVfs();
ChangeListManager.getInstance(myProject).ensureUpToDate(false);
final VcsHistorySession session = getHistorySession(BFILE);
final List<VcsFileRevision> revisions = session.getRevisionList();
for (VcsFileRevision rev : revisions) {
rev.loadContent();
}
assertEquals(revisions.size(), versions);
assertTrue(session.isCurrentRevision(revisions.get(0).getRevisionNumber()));
assertEquals(revisions.get(0).getContent(), UPDATED_FILE_CONTENT.getBytes());
assertEquals(revisions.get(1).getContent(), INITIAL_FILE_CONTENT.getBytes());
}
示例3: loadFromVersionControl
import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
@Nullable
private byte[] loadFromVersionControl(long date, VirtualFile f) {
try {
final AbstractVcs vcs = VcsUtil.getVcsFor(myProject, f);
if (vcs == null) return null;
final VcsHistoryProvider historyProvider = vcs.getVcsHistoryProvider();
if (historyProvider == null) return null;
final FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(f);
final VcsHistorySession session = historyProvider.createSessionFor(filePath);
if (session == null) return null;
final List<VcsFileRevision> list = session.getRevisionList();
if (list != null) {
for (VcsFileRevision revision : list) {
final Date revisionDate = revision.getRevisionDate();
if (revisionDate == null) {
return null;
}
if (revisionDate.getTime() < date) {
return revision.loadContent();
}
}
}
}
catch (Exception e) {
LOG.info(e);
return null;
}
return null;
}
示例4: loadAllRevisions
import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
private static void loadAllRevisions(Collection<VcsFileRevision> revisions) throws Exception {
for (VcsFileRevision rev : revisions) {
rev.loadContent();
}
}