Search in sources :

Example 1 with CvsContentRevision

use of com.intellij.cvsSupport2.changeBrowser.CvsContentRevision in project intellij-community by JetBrains.

the class CvsChangeList method getChanges.

public Collection<Change> getChanges() {
    if (myChanges == null) {
        myChanges = new ArrayList<>();
        for (RevisionWrapper wrapper : myRevisions) {
            final Revision revision = wrapper.getRevision();
            final String state = revision.getState();
            String path = wrapper.getFile();
            final File localFile;
            if (myRootFile != null) {
                final String directorySuffix = myRootFile.isDirectory() ? "/" : "";
                if (StringUtil.startsWithConcatenation(path, myRootPath, directorySuffix)) {
                    path = path.substring(myRootPath.length() + directorySuffix.length());
                    localFile = new File(myRootFile.getPresentableUrl(), path);
                } else {
                    localFile = new File(wrapper.getFile());
                }
            } else {
                localFile = new File(wrapper.getFile());
            }
            final boolean added = isAdded(revision);
            final ContentRevision beforeRevision = added ? null : new CvsContentRevision(new File(wrapper.getFile()), localFile, new SimpleRevision(new CvsRevisionNumber(revision.getNumber()).getPrevNumber().asString()), myEnvironment, myProject);
            final ContentRevision afterRevision = (!added && DEAD_STATE.equals(state)) ? null : new CvsContentRevision(new File(wrapper.getFile()), localFile, new SimpleRevision(revision.getNumber()), myEnvironment, myProject);
            myChanges.add(new Change(beforeRevision, afterRevision));
        }
    }
    return myChanges;
}
Also used : ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) SimpleRevision(com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision) Revision(org.netbeans.lib.cvsclient.command.log.Revision) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) CvsRevisionNumber(com.intellij.cvsSupport2.history.CvsRevisionNumber) SimpleRevision(com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)

Example 2 with CvsContentRevision

use of com.intellij.cvsSupport2.changeBrowser.CvsContentRevision in project intellij-community by JetBrains.

the class CvsDiffProvider method createFileContent.

public ContentRevision createFileContent(final VcsRevisionNumber revisionNumber, VirtualFile selectedFile) {
    if ((revisionNumber instanceof CvsRevisionNumber)) {
        final CvsConnectionSettings settings = CvsEntriesManager.getInstance().getCvsConnectionSettingsFor(selectedFile.getParent());
        final File file = new File(CvsUtil.getModuleName(selectedFile));
        final CvsRevisionNumber cvsRevisionNumber = ((CvsRevisionNumber) revisionNumber);
        final RevisionOrDate versionInfo;
        if (cvsRevisionNumber.getDateOrRevision() != null) {
            versionInfo = RevisionOrDateImpl.createOn(cvsRevisionNumber.getDateOrRevision());
        } else {
            versionInfo = new SimpleRevision(cvsRevisionNumber.asString());
        }
        if (selectedFile.getFileType().isBinary()) {
            return new CvsBinaryContentRevision(file, file, versionInfo, settings, myProject);
        } else {
            return new CvsContentRevision(file, file, versionInfo, settings, myProject);
        }
    } else {
        return null;
    }
}
Also used : CvsContentRevision(com.intellij.cvsSupport2.changeBrowser.CvsContentRevision) CvsConnectionSettings(com.intellij.cvsSupport2.connections.CvsConnectionSettings) CvsBinaryContentRevision(com.intellij.cvsSupport2.changeBrowser.CvsBinaryContentRevision) RevisionOrDate(com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDate) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) CvsRevisionNumber(com.intellij.cvsSupport2.history.CvsRevisionNumber) SimpleRevision(com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)

Aggregations

SimpleRevision (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)2 CvsRevisionNumber (com.intellij.cvsSupport2.history.CvsRevisionNumber)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 File (java.io.File)2 CvsBinaryContentRevision (com.intellij.cvsSupport2.changeBrowser.CvsBinaryContentRevision)1 CvsContentRevision (com.intellij.cvsSupport2.changeBrowser.CvsContentRevision)1 CvsConnectionSettings (com.intellij.cvsSupport2.connections.CvsConnectionSettings)1 RevisionOrDate (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDate)1 Change (com.intellij.openapi.vcs.changes.Change)1 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)1 Revision (org.netbeans.lib.cvsclient.command.log.Revision)1