Search in sources :

Example 16 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class SvnCommittedViewTest method testMoveDirChangeFile.

@Test
public void testMoveDirChangeFile() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");
    VirtualFile d2 = createDirInCommand(myWorkingCopyDir, "d2");
    VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
    VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");
    // r1, addition without history
    checkin();
    final String oldPath = absPath(d1);
    final String oldF11Path = virtualToIoFile(f11).getAbsolutePath();
    moveFileInCommand(d1, d2);
    VcsTestUtil.editFileInCommand(myProject, f11, "new");
    Thread.sleep(100);
    checkin();
    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    vcs.invokeRefreshSvnRoots();
    final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
    final List<SvnChangeList> changeListList = committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(), new SvnRepositoryLocation(myRepoUrl), 0);
    checkList(changeListList, 2, new Data[] { new Data(absPath(d1), FileStatus.MODIFIED, "- moved from .." + File.separatorChar + "d1"), new Data(absPath(f11), FileStatus.MODIFIED, "- moved from " + oldF11Path) });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Test(org.junit.Test)

Example 17 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class SvnCommittedViewTest method testDelete.

@Test
public void testDelete() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    final VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");
    final VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
    final VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");
    // r1, addition without history
    checkin();
    deleteFileInCommand(f11);
    checkin();
    update();
    deleteFileInCommand(d1);
    checkin();
    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    vcs.invokeRefreshSvnRoots();
    final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
    final List<SvnChangeList> changeListList = committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(), new SvnRepositoryLocation(myRepoUrl), 0);
    checkList(changeListList, 2, new Data[] { new Data(absPath(f11), FileStatus.DELETED, null) });
    checkList(changeListList, 3, new Data[] { new Data(absPath(d1), FileStatus.DELETED, null) });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Test(org.junit.Test)

Example 18 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class SvnCommittedViewTest method checkList.

protected void checkList(final List<SvnChangeList> lists, final long revision, final Data[] content) throws Exception {
    SvnChangeList list = null;
    for (SvnChangeList changeList : lists) {
        if (changeList.getNumber() == revision) {
            list = changeList;
        }
    }
    Assert.assertNotNull("Change list #" + revision + " not found.", list);
    final Collection<Change> changes = new ArrayList<>(list.getChanges());
    Assert.assertNotNull("Null changes list", changes);
    Assert.assertEquals(changes.size(), content.length);
    for (Data data : content) {
        boolean found = false;
        for (Change change : changes) {
            if (data.shouldBeComparedWithChange(change)) {
                Assert.assertTrue(Comparing.equal(data.myOriginText, change.getOriginText(myProject)));
                Assert.assertEquals(data.myStatus, change.getFileStatus());
                found = true;
                break;
            }
        }
        Assert.assertTrue(printChanges(data, changes), found);
    }
}
Also used : SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ArrayList(java.util.ArrayList) Change(com.intellij.openapi.vcs.changes.Change)

Example 19 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class MergeFromTheirsResolver method loadSvnChangeListsForPatch.

@NotNull
private List<SvnChangeList> loadSvnChangeListsForPatch(@NotNull TreeConflictDescription description) throws VcsException {
    long max = description.getSourceRightVersion().getPegRevision();
    long min = description.getSourceLeftVersion().getPegRevision();
    SvnRepositoryLocation location = new SvnRepositoryLocation(description.getSourceRightVersion().getRepositoryRoot().toString());
    ChangeBrowserSettings settings = new ChangeBrowserSettings();
    settings.USE_CHANGE_BEFORE_FILTER = settings.USE_CHANGE_AFTER_FILTER = true;
    settings.CHANGE_BEFORE = String.valueOf(max);
    settings.CHANGE_AFTER = String.valueOf(min);
    //noinspection unchecked
    List<SvnChangeList> committedChanges = notNull(myVcs.getCachingCommittedChangesProvider()).getCommittedChanges(settings, location, 0);
    return filter(committedChanges, changeList -> changeList.getNumber() != min);
}
Also used : SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) NotNull(org.jetbrains.annotations.NotNull)

Example 20 with SvnChangeList

use of org.jetbrains.idea.svn.history.SvnChangeList in project intellij-community by JetBrains.

the class SvnRevisionPanel method chooseRevision.

private void chooseRevision() {
    if (myProject != null && myUrlProvider != null) {
        final SvnRepositoryLocation location = new SvnRepositoryLocation(myUrlProvider.getUrl());
        final SvnChangeList version = SvnSelectRevisionUtil.chooseCommittedChangeList(myProject, location, myRoot);
        if (version != null) {
            myRevisionField.setText(String.valueOf(version.getNumber()));
        }
    }
}
Also used : SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList)

Aggregations

SvnChangeList (org.jetbrains.idea.svn.history.SvnChangeList)37 VirtualFile (com.intellij.openapi.vfs.VirtualFile)23 Test (org.junit.Test)22 ChangeBrowserSettings (com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)16 SvnRepositoryLocation (org.jetbrains.idea.svn.history.SvnRepositoryLocation)16 File (java.io.File)13 SvnVcs (org.jetbrains.idea.svn.SvnVcs)7 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)4 NotNull (org.jetbrains.annotations.NotNull)4 Change (com.intellij.openapi.vcs.changes.Change)3 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)3 CommittedChangeList (com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)3 Project (com.intellij.openapi.project.Project)2 VcsException (com.intellij.openapi.vcs.VcsException)2 ContainerUtilRt.emptyList (com.intellij.util.containers.ContainerUtilRt.emptyList)2 KeyAdapter (java.awt.event.KeyAdapter)2 KeyEvent (java.awt.event.KeyEvent)2 MouseEvent (java.awt.event.MouseEvent)2 ArrayList (java.util.ArrayList)2 Collections.singletonList (java.util.Collections.singletonList)2