Search in sources :

Example 26 with Revision

use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.

the class LocalHistoryFacade method getRecentChanges.

public List<RecentChange> getRecentChanges(RootEntry root) {
    List<RecentChange> result = new ArrayList<>();
    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;
}
Also used : RecentChange(com.intellij.history.core.revisions.RecentChange) ChangeRevision(com.intellij.history.core.revisions.ChangeRevision) Revision(com.intellij.history.core.revisions.Revision) ArrayList(java.util.ArrayList) ChangeRevision(com.intellij.history.core.revisions.ChangeRevision)

Example 27 with Revision

use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.

the class BasicsTest method testDoNotRegisterSameUnsavedDocumentContentTwice.

public void testDoNotRegisterSameUnsavedDocumentContentTwice() throws Exception {
    VirtualFile f = createChildData(myRoot, "f.txt");
    setContent(f, "1");
    setDocumentTextFor(f, "2");
    LocalHistory.getInstance().putSystemLabel(myProject, "label");
    LocalHistory.getInstance().putUserLabel(myProject, "label");
    List<Revision> rr = getRevisionsFor(f);
    // 3 changes + 2 labels
    assertEquals(6, rr.size());
    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()));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Revision(com.intellij.history.core.revisions.Revision)

Example 28 with Revision

use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.

the class ExternalChangesAndRefreshingTest method testChangeSetName.

public void testChangeSetName() throws Exception {
    createFileExternally("f.txt");
    refreshVFS();
    Revision r = getRevisionsFor(myRoot).get(1);
    assertEquals("External change", r.getChangeSetName());
}
Also used : Revision(com.intellij.history.core.revisions.Revision)

Example 29 with Revision

use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.

the class FileListeningTest method testCreationAndDeletionOfFileUnderUnversionedDir.

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"));
}
Also used : Revision(com.intellij.history.core.revisions.Revision) Module(com.intellij.openapi.module.Module) NewVirtualFile(com.intellij.openapi.vfs.newvfs.NewVirtualFile) File(java.io.File)

Example 30 with Revision

use of com.intellij.history.core.revisions.Revision in project intellij-community by JetBrains.

the class SelectionReverterTest method createReverter.

private SelectionReverter createReverter(int from, int to) {
    List<Revision> rr = getRevisionsFor(f);
    SelectionCalculator c = new SelectionCalculator(myGateway, rr, from, to);
    Revision leftRev = rr.get(1);
    Entry entry = getRootEntry().getEntry(f.getPath());
    return new SelectionReverter(myProject, getVcs(), myGateway, c, leftRev, entry, from, to);
}
Also used : Entry(com.intellij.history.core.tree.Entry) Revision(com.intellij.history.core.revisions.Revision) SelectionCalculator(com.intellij.history.integration.ui.models.SelectionCalculator)

Aggregations

Revision (com.intellij.history.core.revisions.Revision)44 VirtualFile (com.intellij.openapi.vfs.VirtualFile)29 Difference (com.intellij.history.core.revisions.Difference)7 Test (org.junit.Test)6 Entry (com.intellij.history.core.tree.Entry)5 Block (com.intellij.diff.Block)4 LocalHistoryAction (com.intellij.history.LocalHistoryAction)3 ArrayList (java.util.ArrayList)3 Module (com.intellij.openapi.module.Module)2 NewVirtualFile (com.intellij.openapi.vfs.newvfs.NewVirtualFile)2 File (java.io.File)2 ChangeRevision (com.intellij.history.core.revisions.ChangeRevision)1 RecentChange (com.intellij.history.core.revisions.RecentChange)1 DifferenceReverter (com.intellij.history.integration.revertion.DifferenceReverter)1 DirectoryChangeModel (com.intellij.history.integration.ui.models.DirectoryChangeModel)1 SelectionCalculator (com.intellij.history.integration.ui.models.SelectionCalculator)1 RunnableAdapter (com.intellij.history.utils.RunnableAdapter)1 Change (com.intellij.openapi.vcs.changes.Change)1 IOException (java.io.IOException)1 Date (java.util.Date)1