本文整理匯總了Java中com.intellij.history.core.revisions.Revision類的典型用法代碼示例。如果您正苦於以下問題:Java Revision類的具體用法?Java Revision怎麽用?Java Revision使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Revision類屬於com.intellij.history.core.revisions包,在下文中一共展示了Revision類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRecentChanges
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public List<RecentChange> getRecentChanges(RootEntry root) {
List<RecentChange> result = new ArrayList<RecentChange>();
for (ChangeSet c : myChangeList.iterChanges()) {
if (c.isContentChangeOnly()) continue;
if (c.isLabelOnly()) continue;
if (c.getName() == null) continue;
Revision before = new ChangeRevision(this, root, "", c, true);
Revision after = new ChangeRevision(this, root, "", c, false);
result.add(new RecentChange(before, after));
if (result.size() >= 20) break;
}
return result;
}
示例2: testCreationAndDeletionOfUnversionedFile
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testCreationAndDeletionOfUnversionedFile() throws IOException {
addExcludedDir(myRoot.getPath() + "/dir");
Module m = createModule("foo");
addContentRoot(m, myRoot.getPath() + "/dir/subDir");
createFileExternally("dir/subDir/file.txt");
LocalFileSystem.getInstance().refresh(false);
FileUtil.delete(new File(myRoot.getPath() + "/dir"));
LocalFileSystem.getInstance().refresh(false);
createFileExternally("dir/subDir/file.txt");
LocalFileSystem.getInstance().refresh(false);
List<Revision> revs = getRevisionsFor(myRoot);
assertEquals(4, revs.size());
assertNotNull(revs.get(0).findEntry().findEntry("dir/subDir/file.txt"));
assertNull(revs.get(1).findEntry().findEntry("dir/subDir/file.txt"));
assertNotNull(revs.get(2).findEntry().findEntry("dir/subDir/file.txt"));
assertNull(revs.get(3).findEntry().findEntry("dir/subDir/file.txt"));
}
示例3: testCreationAndDeletionOfFileUnderUnversionedDir
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testCreationAndDeletionOfFileUnderUnversionedDir() throws IOException {
addExcludedDir(myRoot.getPath() + "/dir");
Module m = createModule("foo");
addContentRoot(m, myRoot.getPath() + "/dir/subDir");
createFileExternally("dir/subDir/file.txt");
LocalFileSystem.getInstance().refresh(false);
FileUtil.delete(new File(myRoot.getPath() + "/dir/subDir"));
LocalFileSystem.getInstance().refresh(false);
createFileExternally("dir/subDir/file.txt");
LocalFileSystem.getInstance().refresh(false);
List<Revision> revs = getRevisionsFor(myRoot);
assertEquals(4, revs.size());
assertNotNull(revs.get(0).findEntry().findEntry("dir/subDir/file.txt"));
assertNull(revs.get(1).findEntry().findEntry("dir/subDir"));
assertNotNull(revs.get(2).findEntry().findEntry("dir/subDir/file.txt"));
assertNull(revs.get(3).findEntry().findEntry("dir/subDir"));
}
示例4: testPuttingUserLabel
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testPuttingUserLabel() throws Exception {
VirtualFile f = myRoot.createChildData(null, "f.txt");
LocalHistory.getInstance().putUserLabel(myProject, "global");
assertEquals(3, getRevisionsFor(f).size());
assertEquals(3, getRevisionsFor(myRoot).size());
LocalHistory.getInstance().putUserLabel(myProject, "file");
List<Revision> rr = getRevisionsFor(f);
assertEquals(4, rr.size());
assertEquals("file", rr.get(1).getLabel());
assertEquals(-1, rr.get(1).getLabelColor());
assertEquals("global", rr.get(2).getLabel());
assertEquals(-1, rr.get(2).getLabelColor());
}
示例5: testPuttingSystemLabel
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testPuttingSystemLabel() throws IOException {
VirtualFile f = myRoot.createChildData(null, "file.txt");
assertEquals(2, getRevisionsFor(f).size());
assertEquals(2, getRevisionsFor(myRoot).size());
LocalHistory.getInstance().putSystemLabel(myProject, "label");
List<Revision> rr = getRevisionsFor(f);
assertEquals(3, rr.size());
assertEquals("label", rr.get(1).getLabel());
rr = getRevisionsFor(myRoot);
assertEquals(3, rr.size());
assertEquals("label", rr.get(1).getLabel());
}
示例6: testPuttingLabelWithUnsavedDocuments
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testPuttingLabelWithUnsavedDocuments() throws Exception {
VirtualFile f = myRoot.createChildData(null, "f.txt");
setContent(f, "1");
setDocumentTextFor(f, "2");
LocalHistory.getInstance().putSystemLabel(myProject, "label");
setDocumentTextFor(f, "3");
LocalHistory.getInstance().putUserLabel(myProject, "label");
setDocumentTextFor(f, "4");
LocalHistory.getInstance().putUserLabel(myProject, "label");
List<Revision> rr = getRevisionsFor(f);
assertEquals(9, rr.size()); // 5 changes + 3 labels
assertEquals("4", new String(rr.get(0).findEntry().getContent().getBytes()));
assertEquals("4", new String(rr.get(1).findEntry().getContent().getBytes()));
assertEquals("3", new String(rr.get(2).findEntry().getContent().getBytes()));
assertEquals("3", new String(rr.get(3).findEntry().getContent().getBytes()));
assertEquals("2", new String(rr.get(4).findEntry().getContent().getBytes()));
assertEquals("2", new String(rr.get(5).findEntry().getContent().getBytes()));
assertEquals("1", new String(rr.get(6).findEntry().getContent().getBytes()));
assertEquals("", new String(rr.get(7).findEntry().getContent().getBytes()));
}
示例7: testDoNotRegisterSameUnsavedDocumentContentTwice
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testDoNotRegisterSameUnsavedDocumentContentTwice() throws Exception {
VirtualFile f = myRoot.createChildData(null, "f.txt");
setContent(f, "1");
setDocumentTextFor(f, "2");
LocalHistory.getInstance().putSystemLabel(myProject, "label");
LocalHistory.getInstance().putUserLabel(myProject, "label");
List<Revision> rr = getRevisionsFor(f);
assertEquals(6, rr.size()); // 3 changes + 2 labels
assertEquals("2", new String(rr.get(0).findEntry().getContent().getBytes()));
assertEquals("2", new String(rr.get(1).findEntry().getContent().getBytes()));
assertEquals("2", new String(rr.get(2).findEntry().getContent().getBytes()));
assertEquals("1", new String(rr.get(3).findEntry().getContent().getBytes()));
assertEquals("", new String(rr.get(4).findEntry().getContent().getBytes()));
}
示例8: testIncludingCurrentVersionIntoRevisionsAfterPurge
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testIncludingCurrentVersionIntoRevisionsAfterPurge() throws Exception {
Clock.setTime(10);
VirtualFile f = createFile("file.txt", "content");
loadContent(f);
getVcs().getChangeListInTests().purgeObsolete(0);
List<Revision> rr = getRevisionsFor(f);
assertEquals(1, rr.size());
Revision r = rr.get(0);
assertNull(r.getLabel());
assertNull(r.getChangeSetName());
assertEquals(f.getTimeStamp(), r.getTimestamp());
Entry e = r.findEntry();
assertEquals("file.txt", e.getName());
assertContent("content", e);
}
示例9: testCurrentRevisionForDirectoryAfterPurge
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testCurrentRevisionForDirectoryAfterPurge() throws Exception {
Clock.setTime(10);
VirtualFile f = createDirectory("dir");
getVcs().getChangeListInTests().purgeObsolete(0);
List<Revision> rr = getRevisionsFor(f);
assertEquals(1, rr.size());
Revision r = rr.get(0);
assertNull(r.getLabel());
assertNull(r.getChangeSetName());
assertEquals(-1, r.getTimestamp()); // directory has no timestamp
Entry e = r.findEntry();
assertEquals("dir", e.getName());
}
示例10: testTimestampForLastRevisionAfterPurge
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testTimestampForLastRevisionAfterPurge() throws IOException {
Clock.setTime(10);
VirtualFile f = createFile("file1.txt");
Clock.setTime(20);
setContent(f, "a");
Clock.setTime(30);
setContent(f, "b");
getVcs().getChangeListInTests().purgeObsolete(15);
List<Revision> rr = getRevisionsFor(f);
assertEquals(30L, rr.get(1).getTimestamp());
assertEquals(20L, rr.get(2).getTimestamp());
}
示例11: testRevisionsForFileCreatedWithSameNameAsDeletedOne
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testRevisionsForFileCreatedWithSameNameAsDeletedOne() throws IOException {
VirtualFile f = createFile("file.txt", "old");
loadContent(f);
f.delete(this);
f = createFile("file.txt", "new");
loadContent(f);
List<Revision> rr = getRevisionsFor(f);
assertEquals(4, rr.size());
Entry e = rr.get(0).findEntry();
assertEquals("file.txt", e.getName());
assertContent("new", e);
assertNull(rr.get(1).findEntry());
e = rr.get(2).findEntry();
assertEquals("file.txt", e.getName());
assertContent("old", e);
assertNull(rr.get(3).findEntry());
}
示例12: testRevisionForRestoredDirectoryWithRestoreChildren
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testRevisionForRestoredDirectoryWithRestoreChildren() throws IOException {
VirtualFile dir = createDirectory("dir");
createFile("dir/f.txt");
dir.delete(this);
getVcs().beginChangeSet();
dir = createDirectory("dir");
VirtualFile f = createFile("dir/f.txt");
getVcs().endChangeSet(null);
List<Revision> rr = getRevisionsFor(dir);
assertEquals(5, rr.size());
assertEquals(1, rr.get(0).findEntry().getChildren().size());
assertNull(rr.get(1).findEntry());
assertEquals(1, rr.get(2).findEntry().getChildren().size());
assertEquals(0, rr.get(3).findEntry().getChildren().size());
assertEquals(4, getRevisionsFor(f).size());
}
示例13: testRevisionsForFileCreatedInPlaceOfRenamedOne
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testRevisionsForFileCreatedInPlaceOfRenamedOne() throws IOException {
VirtualFile f = createFile("file1.txt", "content1");
loadContent(f);
f.rename("file1", "file2.txt");
VirtualFile ff = createFile("file1.txt", "content2");
loadContent(ff);
List<Revision> rr = getRevisionsFor(ff);
assertEquals(2, rr.size());
Entry e = rr.get(0).findEntry();
assertEquals("file1.txt", e.getName());
assertContent("content2", e);
rr = getRevisionsFor(f);
assertEquals(3, rr.size());
e = rr.get(0).findEntry();
assertEquals("file2.txt", e.getName());
assertContent("content1", e);
e = rr.get(1).findEntry();
assertEquals("file1.txt", e.getName());
assertContent("content1", e);
}
示例14: testGettingDifferenceBetweenRevisions
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testGettingDifferenceBetweenRevisions() throws IOException {
VirtualFile f = createFile("file.txt", "one");
loadContent(f);
setContent(f, "two");
List<Revision> rr = getRevisionsFor(f);
Revision recent = rr.get(0);
Revision prev = rr.get(1);
List<Difference> dd = prev.getDifferencesWith(recent);
assertEquals(1, dd.size());
Difference d = dd.get(0);
assertContent("one", d.getLeft());
assertContent("two", d.getRight());
}
示例15: testDifferenceForDirectory
import com.intellij.history.core.revisions.Revision; //導入依賴的package包/類
public void testDifferenceForDirectory() throws IOException {
VirtualFile dir = createDirectory("dir");
VirtualFile f = createFile("dir/file.txt");
List<Revision> rr = getRevisionsFor(dir);
assertEquals(3, rr.size());
Revision recent = rr.get(0);
Revision prev = rr.get(1);
List<Difference> dd = prev.getDifferencesWith(recent);
assertEquals(1, dd.size());
Difference d = dd.get(0);
assertNull(d.getLeft());
assertEquals("file.txt", d.getRight().getName());
}