@Override @Nullable public VcsFileRevision getLastRevision(FilePath filePath) throws VcsException { ClientConfigRoot root = getRootFor(filePath); if (root == null) { LOG.info("File not under vcs: " + filePath); return null; } try { List<VcsFileRevision> revisions = getHistory(root, filePath, 1) .blockingGet(UserProjectPreferences.getLockWaitTimeoutMillis(project), TimeUnit.MILLISECONDS) .getRevisions(formatter, loader); if (revisions.isEmpty()) { if (LOG.isDebugEnabled()) { LOG.debug("no revisions found for " + filePath); } return null; } return revisions.get(0); } catch (InterruptedException e) { InternalErrorMessage.send(project).cacheLockTimeoutError(new ErrorEvent<>(new VcsInterruptedException(e))); return null; } }
r.getRevisions(formatter, loader).forEach((rev) -> { VcsRevisionNumber rn = rev.getRevisionNumber(); if (rn instanceof VcsRevisionNumber.Int) {
@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().getServerConfig(), new ListFileHistoryQuery(root.getClientConfig().getClientServerRef(), filePath, -1)) .blockingGet(UserProjectPreferences.getLockWaitTimeoutMillis(project), TimeUnit.MILLISECONDS) .getRevisions(formatter, loader); return createAppendableSession(filePath, revisions, null); } catch (InterruptedException e) { throw new VcsInterruptedException(e); } }
@Override public void reportAppendableHistory(FilePath path, VcsAppendableHistorySessionPartner partner) { partner.reportCreatedEmptySession(createAppendableSession( path, Collections.emptyList(), null)); ClientConfigRoot root = getRootFor(path); if (root == null) { LOG.info("File not under VCS: " + path); // TODO bundle message partner.reportException(new VcsException("File not under VCS: " + path)); partner.finished(); return; } // Async operation. getHistory(root, path, -1) .whenCompleted((r) -> { r.getRevisions(formatter, loader).forEach(partner::acceptRevision); partner.finished(); }) .whenServerError((e) -> { LOG.warn(e); partner.reportException(e); partner.finished(); }); }
new ListFileHistoryQuery(root.getClientConfig().getClientServerRef(), local, 1)) .blockingGet(UserProjectPreferences.getLockWaitTimeoutMillis(project), TimeUnit.MILLISECONDS) .getRevisions(formatter, loader); if (revisions.isEmpty()) { LOG.info("No revisions found for " + file);