public byte[] loadContent() throws IOException, VcsException { ContentLoader loader = new ContentLoader(myURL, myRevision, myPegRevision); if (ApplicationManager.getApplication().isDispatchThread() && !myRevision.isLocal()) { ProgressManager.getInstance() .runProcessWithProgressSynchronously( loader, SvnBundle.message("progress.title.loading.file.content"), false, myVCS.getProject()); } else { loader.run(); } VcsException exception = loader.getException(); if (exception == null) { final byte[] contents = loader.getContents(); ContentRevisionCache.checkContentsSize(myURL, contents.length); return contents; } else { LOG.info( "Failed to load file '" + myURL + "' content at revision: " + myRevision + "\n" + exception.getMessage(), exception); throw exception; } }
@Nullable public String getContent() throws VcsException { try { if (myUseBaseRevision) { return ContentRevisionCache.getOrLoadCurrentAsString( myVcs.getProject(), myFile, myVcs.getKeyInstanceMethod(), new CurrentRevisionProvider() { @Override public VcsRevisionNumber getCurrentRevision() throws VcsException { return getRevisionNumber(); } @Override public Pair<VcsRevisionNumber, byte[]> get() throws VcsException, IOException { return Pair.create(getRevisionNumber(), getUpToDateBinaryContent()); } }) .getSecond(); } else { return ContentRevisionCache.getOrLoadAsString( myVcs.getProject(), myFile, getRevisionNumber(), myVcs.getKeyInstanceMethod(), ContentRevisionCache.UniqueType.REPOSITORY_CONTENT, new Throwable2Computable<byte[], VcsException, IOException>() { @Override public byte[] compute() throws VcsException, IOException { return getUpToDateBinaryContent(); } }); } } catch (IOException e) { throw new VcsException(e); } }
public synchronized byte[] getContent() throws IOException, VcsException { if (myNoCache) { return loadContent(); } return ContentRevisionCache.getOrLoadAsBytes( project, path, revision, GitVcs.getKey(), ContentRevisionCache.UniqueType.REPOSITORY_CONTENT, new Throwable2Computable<byte[], VcsException, IOException>() { @Override public byte[] compute() throws VcsException, IOException { return loadContent(); } }); }
public byte[] getContent() throws IOException, VcsException { byte[] result; if (SVNRevision.HEAD.equals(myRevision)) { result = loadContent(); } else { result = ContentRevisionCache.getOrLoadAsBytes( myVCS.getProject(), VcsUtil.getFilePathOnNonLocal(myURL, false), getRevisionNumber(), myVCS.getKeyInstanceMethod(), ContentRevisionCache.UniqueType.REMOTE_CONTENT, new Throwable2Computable<byte[], VcsException, IOException>() { @Override public byte[] compute() throws VcsException, IOException { return loadContent(); } }); } return result; }