Пример #1
0
  @Override
  public List<Commit> getHistory(int page, int limit, String until)
      throws AmbiguousObjectException, IOException, NoHeadException, GitAPIException, SVNException {
    // Get the repository
    SVNURL svnURL = SVNURL.fromFile(new File(repoPrefix + ownerName + "/" + projectName));
    org.tmatesoft.svn.core.io.SVNRepository repository = SVNRepositoryFactory.create(svnURL);

    // path to get log
    String[] paths = {"/"};

    // Determine revisions
    long startRevision = repository.getLatestRevision() - page * limit;
    long endRevision = startRevision - limit;
    if (endRevision < 1) {
      endRevision = 1;
    }

    // No log to return.
    if (startRevision < endRevision) {
      return new ArrayList<>();
    }

    // Get the logs
    List<Commit> result = new ArrayList<>();
    for (Object entry : repository.log(paths, null, startRevision, endRevision, false, false)) {
      result.add(new SvnCommit((SVNLogEntry) entry));
    }

    return result;
  }
Пример #2
0
  @Override
  public Commit getCommit(String revNumber) throws IOException, SVNException {
    long rev = Integer.parseInt(revNumber);
    String[] paths = {"/"};
    SVNURL svnURL = SVNURL.fromFile(new File(getRepoPrefix() + ownerName + "/" + projectName));
    org.tmatesoft.svn.core.io.SVNRepository repository = SVNRepositoryFactory.create(svnURL);

    for (Object entry : repository.log(paths, null, rev, rev, false, false)) {
      return new SvnCommit((SVNLogEntry) entry);
    }

    return null;
  }