Search in sources :

Example 1 with RecentChange

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

the class RecentChangeDialogTest method testDialogWork.

public void testDialogWork() throws IOException {
    getVcs().beginChangeSet();
    createChildData(myRoot, "f.txt");
    getVcs().endChangeSet("change");
    RecentChange c = getVcs().getRecentChanges(getRootEntry()).get(0);
    RecentChangeDialog d = null;
    try {
        d = new RecentChangeDialog(myProject, myGateway, c);
    } finally {
        if (d != null) {
            Disposer.dispose(d);
        }
    }
}
Also used : RecentChange(com.intellij.history.core.revisions.RecentChange) RecentChangeDialog(com.intellij.history.integration.ui.views.RecentChangeDialog)

Example 2 with RecentChange

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

the class LocalVcsRecentChangesTest method testDoesNotIncludeUnnamedChanges.

@Test
public void testDoesNotIncludeUnnamedChanges() {
    vcs.beginChangeSet();
    add(vcs, createFile(root, "f1"));
    vcs.endChangeSet("a");
    add(vcs, createFile(root, "f2"));
    vcs.beginChangeSet();
    add(vcs, createFile(root, "f3"));
    vcs.endChangeSet("b");
    List<RecentChange> cc = vcs.getRecentChanges(root);
    assertRecentChanges(cc, "b", "a");
    RecentChange c0 = cc.get(0);
    RecentChange c1 = cc.get(1);
    assertNotNull(findEntryAfter(c0, "f1"));
    assertNotNull(findEntryAfter(c0, "f2"));
    assertNotNull(findEntryAfter(c0, "f3"));
    assertNotNull(findEntryBefore(c0, "f1"));
    assertNotNull(findEntryBefore(c0, "f2"));
    assertNull(findEntryBefore(c0, "f3"));
    assertNotNull(findEntryAfter(c1, "f1"));
    assertNull(findEntryAfter(c1, "f2"));
    assertNull(findEntryAfter(c1, "f3"));
    assertNull(findEntryBefore(c1, "f1"));
    assertNull(findEntryBefore(c1, "f2"));
    assertNull(findEntryBefore(c1, "f3"));
}
Also used : RecentChange(com.intellij.history.core.revisions.RecentChange) Test(org.junit.Test)

Example 3 with RecentChange

use of com.intellij.history.core.revisions.RecentChange 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 4 with RecentChange

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

the class LocalVcsRecentChangesTest method testRecentChanges.

@Test
public void testRecentChanges() {
    vcs.beginChangeSet();
    add(vcs, createFile(root, "f1"));
    vcs.endChangeSet("a");
    vcs.beginChangeSet();
    add(vcs, createFile(root, "f2"));
    vcs.endChangeSet("b");
    List<RecentChange> cc = vcs.getRecentChanges(root);
    assertRecentChanges(cc, "b", "a");
    RecentChange c0 = cc.get(0);
    RecentChange c1 = cc.get(1);
    assertNotNull(findEntryAfter(c0, "f1"));
    assertNotNull(findEntryAfter(c0, "f2"));
    assertNotNull(findEntryBefore(c0, "f1"));
    assertNull(findEntryBefore(c0, "f2"));
    assertNotNull(findEntryAfter(c1, "f1"));
    assertNull(findEntryAfter(c1, "f2"));
    assertNull(findEntryBefore(c1, "f1"));
    assertNull(findEntryBefore(c1, "f2"));
}
Also used : RecentChange(com.intellij.history.core.revisions.RecentChange) Test(org.junit.Test)

Example 5 with RecentChange

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

the class RecentChangeDialogTest method testRevertChange.

public void testRevertChange() throws IOException {
    getVcs().beginChangeSet();
    createChildData(myRoot, "f1.txt");
    getVcs().endChangeSet("change");
    getVcs().beginChangeSet();
    createChildData(myRoot, "f2.txt");
    getVcs().endChangeSet("another change");
    RecentChange c = getVcs().getRecentChanges(getRootEntry()).get(1);
    RecentChangeDialogModel m = new RecentChangeDialogModel(myProject, myGateway, getVcs(), c);
    Reverter r = m.createReverter();
    r.revert();
    assertNull(myRoot.findChild("f1.txt"));
    assertNotNull(myRoot.findChild("f2.txt"));
}
Also used : RecentChange(com.intellij.history.core.revisions.RecentChange) Reverter(com.intellij.history.integration.revertion.Reverter) RecentChangeDialogModel(com.intellij.history.integration.ui.models.RecentChangeDialogModel)

Aggregations

RecentChange (com.intellij.history.core.revisions.RecentChange)5 Test (org.junit.Test)2 ChangeRevision (com.intellij.history.core.revisions.ChangeRevision)1 Revision (com.intellij.history.core.revisions.Revision)1 Reverter (com.intellij.history.integration.revertion.Reverter)1 RecentChangeDialogModel (com.intellij.history.integration.ui.models.RecentChangeDialogModel)1 RecentChangeDialog (com.intellij.history.integration.ui.views.RecentChangeDialog)1 ArrayList (java.util.ArrayList)1