Search in sources :

Example 11 with CvsRevisionNumber

use of com.intellij.cvsSupport2.history.CvsRevisionNumber in project intellij-community by JetBrains.

the class CvsChangeList method isAdded.

private static boolean isAdded(final Revision revision) {
    final String revisionState = revision.getState();
    if (EXP_STATE.equals(revisionState) && revision.getLines() == null) {
        return true;
    }
    if (ADDED_STATE.equals(revisionState)) {
        return true;
    }
    // files added on branch
    final int[] subRevisions = new CvsRevisionNumber(revision.getNumber()).getSubRevisions();
    if (subRevisions != null && subRevisions.length > 2 && subRevisions[subRevisions.length - 1] == 1) {
        return true;
    }
    return false;
}
Also used : CvsRevisionNumber(com.intellij.cvsSupport2.history.CvsRevisionNumber)

Example 12 with CvsRevisionNumber

use of com.intellij.cvsSupport2.history.CvsRevisionNumber in project intellij-community by JetBrains.

the class CvsCommittedChangesProvider method isChangeLocallyAvailable.

public boolean isChangeLocallyAvailable(final FilePath filePath, @Nullable VcsRevisionNumber localRevision, VcsRevisionNumber changeRevision, final CvsChangeList changeList) {
    if (localRevision instanceof CvsRevisionNumber && changeRevision instanceof CvsRevisionNumber) {
        final CvsRevisionNumber cvsLocalRevision = (CvsRevisionNumber) localRevision;
        final CvsRevisionNumber cvsChangeRevision = (CvsRevisionNumber) changeRevision;
        final int[] localSubRevisions = cvsLocalRevision.getSubRevisions();
        final int[] changeSubRevisions = cvsChangeRevision.getSubRevisions();
        if (localSubRevisions != null && changeSubRevisions != null) {
            if (localSubRevisions.length != changeSubRevisions.length) {
                // local is trunk, change is branch / vice versa
                return true;
            }
            for (int i = 2; i < localSubRevisions.length; i += 2) {
                if (localSubRevisions[i] != changeSubRevisions[i]) {
                    // local is one branch, change is a different branch
                    return true;
                }
            }
        }
    }
    return isDifferentBranch(filePath, changeList) || (localRevision != null && localRevision.compareTo(changeRevision) >= 0);
}
Also used : CvsRevisionNumber(com.intellij.cvsSupport2.history.CvsRevisionNumber)

Aggregations

CvsRevisionNumber (com.intellij.cvsSupport2.history.CvsRevisionNumber)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 Nullable (org.jetbrains.annotations.Nullable)4 File (java.io.File)3 SimpleRevision (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)2 CvsBinaryContentRevision (com.intellij.cvsSupport2.changeBrowser.CvsBinaryContentRevision)1 CvsContentRevision (com.intellij.cvsSupport2.changeBrowser.CvsContentRevision)1 CvsConnectionSettings (com.intellij.cvsSupport2.connections.CvsConnectionSettings)1 CvsExecutionEnvironment (com.intellij.cvsSupport2.cvsoperations.common.CvsExecutionEnvironment)1 ErrorProcessor (com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorProcessor)1 LocalPathIndifferentLogOperation (com.intellij.cvsSupport2.cvsoperations.cvsLog.LocalPathIndifferentLogOperation)1 CvsMessagesAdapter (com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesAdapter)1 SelectTagDialog (com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.ui.SelectTagDialog)1 RevisionOrDate (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDate)1 Ref (com.intellij.openapi.util.Ref)1 VcsException (com.intellij.openapi.vcs.VcsException)1 Change (com.intellij.openapi.vcs.changes.Change)1 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)1 ItemLatestState (com.intellij.openapi.vcs.diff.ItemLatestState)1 FileGroup (com.intellij.openapi.vcs.update.FileGroup)1