コード例 #1
0
  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;
    }
  }
コード例 #2
0
  @Nullable
  private String getLastMergedRevision(final SVNRevision rev2, final SVNURL svnURL2) {
    if (!rev2.isValid() || rev2.isLocal()) {
      return null;
    } else {
      final long number = rev2.getNumber();
      if (number > 0) {
        return String.valueOf(number);
      } else {

        SVNRepository repos = null;
        try {
          repos = myVcs.createRepository(svnURL2.toString());
          final long latestRev = repos.getLatestRevision();
          return String.valueOf(latestRev);
        } catch (SVNException e) {
          return null;
        } finally {
          if (repos != null) {
            repos.closeSession();
          }
        }
      }
    }
  }