SVNKitRepositoryService extends AbstractRepositoryService { @Override public Revision translateRevision(final SVNConnection connection, final Revision revision, final long headRevision) throws SventonException { final long revisionNumber = revision.getNumber(); try { if (revision.isHeadRevision() || revisionNumber == headRevision) { return Revision.createHeadRevision(headRevision); } if (revisionNumber < 0) { final Date date = revision.getDate(); if (date != null) { final SVNRepository repository = ((SVNKitConnection) connection).getDelegate(); return Revision.create(date, repository.getDatedRevision(date)); } else { logger.warn("Unexpected revision: " + revision); return Revision.createHeadRevision(headRevision); } } return Revision.create(revisionNumber); } catch (SVNException ex) { return translateException("Unable to translate revision: " + revision, ex); } }  @Override LogEntry getLogEntry(final SVNConnection connection, final RepositoryName repositoryName, final long revision); @Override final List<LogEntry> getLogEntriesFromRepositoryRoot(final SVNConnection connection, final long fromRevision,
                                                              final long toRevision); @Override List<LogEntry> getLogEntries(final SVNConnection connection, final RepositoryName repositoryName,
                                      final long fromRevision, final long toRevision, final String path,
                                      final long limit, final boolean stopOnCopy, boolean includeChangedPaths); @Override final void export(final SVNConnection connection, final List<PathRevision> targets, final long pegRevision,
                           final File exportDirectory); @Override void getFileContents(final SVNConnection connection, final String path, final long revision,
                              final OutputStream output); @Override final Properties listProperties(final SVNConnection connection, final String path, final long revision); @Override final Long getLatestRevision(final SVNConnection connection); @Override final DirEntry.Kind getNodeKind(final SVNConnection connection, final String path, final long revision); @Override Map<String, DirEntryLock> getLocks(final SVNConnection connection, final String startPath, final boolean recursive); @SuppressWarnings({"unchecked"}) @Override final DirList list(final SVNConnection connection, final String path, final long revision); @Override final DirEntry getEntryInfo(final SVNConnection connection, final String path, final long revision); @SuppressWarnings({"unchecked"}) @Override final List<FileRevision> getFileRevisions(final SVNConnection connection, final String path, final long revision); @Override final String diffUnified(final SVNConnection connection, final PathRevision from, final PathRevision to,
                                  final Revision pegRevision, final String charset); @Override final List<DiffStatus> diffPaths(final SVNConnection connection, final PathRevision from, final PathRevision to); @Override final AnnotatedTextFile blame(final SVNConnection connection, final String path, final long revision,
                                       final String charset, final Colorer colorer); @Override Revision translateRevision(final SVNConnection connection, final Revision revision, final long headRevision); @Override List<Long> getRevisionsForPath(final SVNConnection connection, final String path, final long fromRevision,
                                        final long toRevision, final boolean stopOnCopy, final long limit);  }
@Test public void testTranslateRevision() throws Exception { final SVNKitRepositoryService service = new SVNKitRepositoryService(); Revision revision; revision = service.translateRevision(null, Revision.parse("head"), 100); assertEquals(100, revision.getNumber()); assertTrue(revision.isHeadRevision()); revision = service.translateRevision(null, Revision.parse(""), 100); assertEquals(100, revision.getNumber()); assertTrue(revision.isHeadRevision()); revision = service.translateRevision(null, Revision.parse("123"), 200); assertEquals(Revision.create(123), revision); assertFalse(revision.isHeadRevision()); revision = service.translateRevision(null, Revision.parse("200"), 200); assertEquals(Revision.create(200).getNumber(), revision.getNumber()); assertTrue(revision.isHeadRevision()); assertEquals("HEAD", revision.toString()); final SVNRepository repositoryMock = mock(SVNRepository.class); when(repositoryMock.getDatedRevision(Mockito.isA(Date.class))).thenReturn(123L); revision = service.translateRevision(new SVNKitConnection(repositoryMock, null, null), Revision.parse("{2007-01-01}"), 200); assertEquals(123, revision.getNumber()); assertFalse(revision.isHeadRevision()); }