Search in sources :

Example 1 with CurrentContentRevision

use of com.intellij.openapi.vcs.changes.CurrentContentRevision in project intellij-community by JetBrains.

the class SvnProtocolsTest method testCommitImpl.

private File testCommitImpl(File wc1) throws IOException {
    Assert.assertTrue(wc1.isDirectory());
    final File file = FileUtil.createTempFile(wc1, "file", ".txt");
    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
    Assert.assertNotNull(vf);
    final ArrayList<VirtualFile> files = new ArrayList<>();
    files.add(vf);
    final List<VcsException> exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files);
    Assert.assertTrue(exceptions.isEmpty());
    final Change change = new Change(null, new CurrentContentRevision(VcsUtil.getFilePath(vf)));
    final List<VcsException> commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit");
    Assert.assertTrue(commit.isEmpty());
    return file;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CurrentContentRevision(com.intellij.openapi.vcs.changes.CurrentContentRevision) VcsException(com.intellij.openapi.vcs.VcsException) ArrayList(java.util.ArrayList) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 2 with CurrentContentRevision

use of com.intellij.openapi.vcs.changes.CurrentContentRevision in project intellij-community by JetBrains.

the class AbstractFilePatchInProgress method getCurrentRevision.

private ContentRevision getCurrentRevision() {
    if (FilePatchStatus.ADDED.equals(myStatus))
        return null;
    if (myCurrentRevision == null) {
        FilePath filePath = (myCurrentBase != null) ? VcsUtil.getFilePath(myCurrentBase) : VcsUtil.getFilePath(myIoCurrentBase, false);
        myCurrentRevision = new CurrentContentRevision(filePath);
    }
    return myCurrentRevision;
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) CurrentContentRevision(com.intellij.openapi.vcs.changes.CurrentContentRevision)

Example 3 with CurrentContentRevision

use of com.intellij.openapi.vcs.changes.CurrentContentRevision in project intellij-community by JetBrains.

the class FileHistoryPanelImpl method getChanges.

@Nullable
private Change[] getChanges() {
    final VcsFileRevision[] revisions = getSelectedRevisions();
    if (revisions.length > 0) {
        Arrays.sort(revisions, Comparator.comparing(VcsRevisionDescription::getRevisionNumber));
        for (VcsFileRevision revision : revisions) {
            if (!myHistorySession.isContentAvailable(revision)) {
                return null;
            }
        }
        final ContentRevision startRevision = new LoadedContentRevision(myFilePath, revisions[0], myVcs.getProject());
        final ContentRevision endRevision = (revisions.length == 1) ? new CurrentContentRevision(myFilePath) : new LoadedContentRevision(myFilePath, revisions[revisions.length - 1], myVcs.getProject());
        return new Change[] { new Change(startRevision, endRevision) };
    }
    return null;
}
Also used : CurrentContentRevision(com.intellij.openapi.vcs.changes.CurrentContentRevision) CurrentContentRevision(com.intellij.openapi.vcs.changes.CurrentContentRevision) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) ByteBackedContentRevision(com.intellij.openapi.vcs.changes.ByteBackedContentRevision) Change(com.intellij.openapi.vcs.changes.Change) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with CurrentContentRevision

use of com.intellij.openapi.vcs.changes.CurrentContentRevision in project intellij-community by JetBrains.

the class SvnNativeClientAuthTest method testCommitImpl.

private File testCommitImpl(File wc1) throws IOException {
    Assert.assertTrue(wc1.isDirectory());
    final File file = FileUtil.createTempFile(wc1, "file", ".txt");
    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
    Assert.assertNotNull(vf);
    final ArrayList<VirtualFile> files = new ArrayList<>();
    files.add(vf);
    final List<VcsException> exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files);
    Assert.assertTrue(exceptions.isEmpty());
    final Change change = new Change(null, new CurrentContentRevision(VcsUtil.getFilePath(vf)));
    final List<VcsException> commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit");
    Assert.assertTrue(commit.isEmpty());
    ++myExpectedCreds;
    ++myExpectedCert;
    return file;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CurrentContentRevision(com.intellij.openapi.vcs.changes.CurrentContentRevision) ArrayList(java.util.ArrayList) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

CurrentContentRevision (com.intellij.openapi.vcs.changes.CurrentContentRevision)4 Change (com.intellij.openapi.vcs.changes.Change)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 FilePath (com.intellij.openapi.vcs.FilePath)1 VcsException (com.intellij.openapi.vcs.VcsException)1 ByteBackedContentRevision (com.intellij.openapi.vcs.changes.ByteBackedContentRevision)1 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)1 Nullable (org.jetbrains.annotations.Nullable)1