use of org.tmatesoft.svn.core.wc.SVNLogClient in project intellij-community by JetBrains.
the class SvnKitBrowseClient method list.
@Override
public void list(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable Depth depth, @Nullable DirectoryEntryConsumer handler) throws VcsException {
assertUrl(target);
SVNLogClient client = getLogClient();
ISVNDirEntryHandler wrappedHandler = wrapHandler(handler);
client.setIgnoreExternals(true);
try {
if (target.isFile()) {
client.doList(target.getFile(), target.getPegRevision(), notNullize(revision), true, toDepth(depth), SVNDirEntry.DIRENT_ALL, wrappedHandler);
} else {
client.doList(target.getURL(), target.getPegRevision(), notNullize(revision), true, toDepth(depth), SVNDirEntry.DIRENT_ALL, wrappedHandler);
}
} catch (SVNException e) {
throw new SvnBindException(e);
}
}
use of org.tmatesoft.svn.core.wc.SVNLogClient in project intellij-community by JetBrains.
the class SvnKitAnnotateClient method annotate.
@Override
public void annotate(@NotNull SvnTarget target, @NotNull SVNRevision startRevision, @NotNull SVNRevision endRevision, boolean includeMergedRevisions, @Nullable DiffOptions diffOptions, @Nullable AnnotationConsumer handler) throws VcsException {
try {
SVNLogClient client = myVcs.getSvnKitManager().createLogClient();
client.setDiffOptions(toDiffOptions(diffOptions));
if (target.isFile()) {
client.doAnnotate(target.getFile(), target.getPegRevision(), startRevision, endRevision, true, includeMergedRevisions, toAnnotateHandler(handler), null);
} else {
client.doAnnotate(target.getURL(), target.getPegRevision(), startRevision, endRevision, true, includeMergedRevisions, toAnnotateHandler(handler), null);
}
} catch (SVNException e) {
throw new VcsException(e);
}
}
use of org.tmatesoft.svn.core.wc.SVNLogClient in project Gargoyle by callakrsos.
the class SVNLog method log.
public List<SVNLogEntry> log(String path, long startRevision, Date endDate, Consumer<Exception> exceptionHandler) {
SVNLogClient logClient = getSvnManager().getLogClient();
List<SVNLogEntry> result = new ArrayList<>();
try {
ISVNLogEntryHandler handler = logEntry -> {
LOGGER.debug("path :: {} rivision :: {} date :: {} author :: {} message :: {} ", path, logEntry.getRevision(), logEntry.getDate(), logEntry.getAuthor(), logEntry.getMessage());
result.add(logEntry);
};
logServer(path, startRevision, endDate, logClient, handler);
} catch (SVNException e) {
LOGGER.error(ValueUtil.toString(e));
if (exceptionHandler != null)
exceptionHandler.accept(e);
}
return result;
}
use of org.tmatesoft.svn.core.wc.SVNLogClient in project sonarqube by SonarSource.
the class SvnScmProviderTest method computeChangedPaths_should_not_crash_when_getRepositoryRootURL_getPath_is_empty.
@Test
public void computeChangedPaths_should_not_crash_when_getRepositoryRootURL_getPath_is_empty() throws SVNException {
// verify assumptions about what SVNKit returns as svn root path for urls like http://svnserver/
assertThat(SVNURL.parseURIEncoded("http://svnserver/").getPath()).isEmpty();
assertThat(SVNURL.parseURIEncoded("http://svnserver").getPath()).isEmpty();
SVNClientManager svnClientManagerMock = mock(SVNClientManager.class);
SVNWCClient svnwcClientMock = mock(SVNWCClient.class);
when(svnClientManagerMock.getWCClient()).thenReturn(svnwcClientMock);
SVNLogClient svnLogClient = mock(SVNLogClient.class);
when(svnClientManagerMock.getLogClient()).thenReturn(svnLogClient);
SVNInfo svnInfoMock = mock(SVNInfo.class);
when(svnwcClientMock.doInfo(any(), any())).thenReturn(svnInfoMock);
// Simulate repository root on /, SVNKIT then returns an repository root url WITHOUT / at the end.
when(svnInfoMock.getRepositoryRootURL()).thenReturn(SVNURL.parseURIEncoded("http://svnserver"));
when(svnInfoMock.getURL()).thenReturn(SVNURL.parseURIEncoded("http://svnserver/myproject/trunk/"));
assertThat(SvnScmProvider.computeChangedPaths(Paths.get("/"), svnClientManagerMock)).isEmpty();
}
use of org.tmatesoft.svn.core.wc.SVNLogClient in project sonarqube by SonarSource.
the class SvnBlameCommand method blame.
@VisibleForTesting
void blame(SVNClientManager clientManager, InputFile inputFile, BlameOutput output) {
String filename = inputFile.relativePath();
LOG.debug("Process file {}", filename);
AnnotationHandler handler = new AnnotationHandler();
try {
if (!checkStatus(clientManager, inputFile)) {
return;
}
SVNLogClient logClient = clientManager.getLogClient();
logClient.setDiffOptions(new SVNDiffOptions(true, true, true));
logClient.doAnnotate(inputFile.file(), SVNRevision.UNDEFINED, SVNRevision.create(1), SVNRevision.BASE, true, true, handler, null);
} catch (SVNAuthenticationException e) {
if (configuration.isEmpty()) {
LOG.warn("Authentication to SVN server is required but no authentication data was passed to the scanner");
}
throw new IllegalStateException("Authentication error when executing blame for file " + filename, e);
} catch (SVNException e) {
throw new IllegalStateException("Error when executing blame for file " + filename, e);
}
List<BlameLine> lines = handler.getLines();
if (lines.size() == inputFile.lines() - 1) {
// SONARPLUGINS-3097 SVN do not report blame on last empty line
lines.add(lines.get(lines.size() - 1));
}
output.blameResult(inputFile, lines);
}
Aggregations