com.intellij.openapi.vcs.history.VcsHistorySession Java Examples

The following examples show how to use com.intellij.openapi.vcs.history.VcsHistorySession. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TFSHistoryProvider.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
private static VcsAbstractHistorySession createSession(final VcsRevisionNumber currentRevisionNumber,
                                                       final List<TfsFileRevision> revisions,
                                                       final boolean isFile) {
    return new VcsAbstractHistorySession(revisions) {
        public VcsRevisionNumber calcCurrentRevisionNumber() {
            return currentRevisionNumber;
        }

        public HistoryAsTreeProvider getHistoryAsTreeProvider() {
            return null;
        }

        @Override
        public VcsHistorySession copy() {
            return createSession(currentRevisionNumber, revisions, isFile);
        }

        @Override
        public boolean isContentAvailable(final VcsFileRevision revision) {
            return isFile;
        }
    };
}
 
Example #2
Source File: P4HistoryProvider.java    From p4ic4idea with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public VcsHistorySession createSessionFor(FilePath filePath) throws VcsException {
    ClientConfigRoot root = getRootFor(filePath);
    if (root == null) {
        LOG.info("Not in P4 project: " + filePath);
        return null;
    }

    try {
        List<VcsFileRevision> revisions = P4ServerComponent
                .query(project, root.getClientConfig(),
                        new ListFileHistoryQuery(filePath, -1))
                .blockingGet(UserProjectPreferences.getLockWaitTimeoutMillis(project), TimeUnit.MILLISECONDS)
                .getRevisions(formatter, loader);
        return createAppendableSession(filePath, revisions, null);
    } catch (InterruptedException e) {
        throw new VcsInterruptedException(e);
    }
}
 
Example #3
Source File: TFSHistoryProvider.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@Nullable
public VcsHistorySession createSessionFor(final FilePath filePath) throws VcsException {
    try {
        final List<TfsFileRevision> revisions =
                getRevisions(project, TFSVcs.getInstance(project).getServerContext(true), filePath, filePath.isDirectory());
        if (revisions.isEmpty()) {
            return null;
        }

        return createSession(revisions.get(0).getRevisionNumber(), revisions, !filePath.isDirectory());
    } catch (Exception e) {
        throw new VcsException(e);
    }
}
 
Example #4
Source File: TFSHistoryProvider.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
public VcsDependentHistoryComponents getUICustomization(final VcsHistorySession session, final JComponent forShortcutRegistration) {
    return VcsDependentHistoryComponents.createOnlyColumns(ColumnInfo.EMPTY_ARRAY);
}
 
Example #5
Source File: TFSHistoryProvider.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
public void reportAppendableHistory(final FilePath path, final VcsAppendableHistorySessionPartner partner) throws VcsException {
    final VcsHistorySession session = createSessionFor(path);
    partner.reportCreatedEmptySession((VcsAbstractHistorySession) session);
}
 
Example #6
Source File: P4HistoryProvider.java    From p4ic4idea with Apache License 2.0 4 votes vote down vote up
@Override
public VcsDependentHistoryComponents getUICustomization(VcsHistorySession session, JComponent forShortcutRegistration) {
    return VcsDependentHistoryComponents.createOnlyColumns(ADDITIONAL_HISTORY_COLUMNS);
}