public ArrayList<SVNLogEntry> diffsBetweenTwoRevAndChangeTypes( SVNCommit revisionNew, SVNCommit revisionOld) { try { repository.setAuthenticationManager(authManager); Collection logEntries = new ArrayList<>(); ArrayList<SVNLogEntry> result = new ArrayList<>(); logEntries = repository.log( new String[] {""}, null, revisionOld.getId(), revisionNew.getId(), true, true); for (Iterator entries = logEntries.iterator(); entries.hasNext(); ) { SVNLogEntry logEntry = (SVNLogEntry) entries.next(); result.add(logEntry); } return result; } catch (Exception e) { e.printStackTrace(); return null; } }
public ArrayList<SVNCommit> getAllRevisions() { if (latestRevision < 1l) return revisions; try { final Collection<SVNLogEntry> logEntries = repository.log( new String[] {""}, null, lastSeenRevision + 1l, latestRevision, true, true); for (final SVNLogEntry logEntry : logEntries) { final SVNCommit revision = new SVNCommit(repository, this, logEntry); revision.setId("" + logEntry.getRevision()); if (logEntry.getAuthor() == null) revision.setCommitter(logEntry.getAuthor()); else revision.setCommitter("anonymous"); revision.setDate(logEntry.getDate()); revision.setMessage(logEntry.getMessage()); if (logEntry.getChangedPaths() != null && logEntry.getChangedPaths().size() > 0) { final HashMap<String, String> rChangedPaths = new HashMap<String, String>(); final HashMap<String, String> rRemovedPaths = new HashMap<String, String>(); final HashMap<String, String> rAddedPaths = new HashMap<String, String>(); for (final Iterator changedPaths = logEntry.getChangedPaths().keySet().iterator(); changedPaths.hasNext(); ) { final SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry.getChangedPaths().get(changedPaths.next()); if (repository.checkPath(entryPath.getPath(), logEntry.getRevision()) == SVNNodeKind.FILE) { if (entryPath.getType() == SVNLogEntryPath.TYPE_DELETED) rRemovedPaths.put(entryPath.getPath(), entryPath.getCopyPath()); else if (entryPath.getType() == SVNLogEntryPath.TYPE_ADDED) rAddedPaths.put(entryPath.getPath(), entryPath.getCopyPath()); else rChangedPaths.put(entryPath.getPath(), entryPath.getCopyPath()); } } revision.setChangedPaths(rChangedPaths); revision.setRemovedPaths(rRemovedPaths); revision.setAddedPaths(rAddedPaths); } this.revisions.add(revision); } } catch (final SVNException e) { e.printStackTrace(); } return revisions; }