use of org.tmatesoft.svn.core.wc.SVNStatusClient in project MassBank-web by MassBank.
the class SVNClientWrapper method getStatus.
/*
* Collects status information on a single Working Copy item.
*/
public StatusHandler getStatus() throws SVNException {
SVNStatusClient client = this.manager.getStatusClient();
StatusHandler status = null;
boolean reportAll = false;
boolean checkouted = false;
int cnt = 0;
while (true) {
try {
StatusHandler sh = new StatusHandler(checkouted);
long revision = client.doStatus(this.workCopy, true, true, reportAll, false, true, sh);
return sh;
} catch (SVNException e1) {
SVNErrorCode errCode = e1.getErrorMessage().getErrorCode();
// E155007
if (errCode == SVNErrorCode.WC_NOT_DIRECTORY) {
try {
checkout();
reportAll = checkouted = true;
} catch (SVNException e2) {
throw e2;
}
} else {
int ret = handleError("delete", e1, ++cnt);
switch(ret) {
case ERROR_NEXT_THROW:
throw e1;
case ERROR_NEXT_BREAK:
return null;
case ERROR_NEXT_RETRY:
continue;
}
}
}
}
}
use of org.tmatesoft.svn.core.wc.SVNStatusClient in project sonarqube by SonarSource.
the class SvnBlameCommandTest method blame_givenCredentialsSupplied_doNotlogWarning.
@Test
public void blame_givenCredentialsSupplied_doNotlogWarning() throws Exception {
BlameOutput output = mock(BlameOutput.class);
InputFile inputFile = mock(InputFile.class);
SvnConfiguration properties = mock(SvnConfiguration.class);
SvnBlameCommand svnBlameCommand = new SvnBlameCommand(properties);
SVNClientManager clientManager = mock(SVNClientManager.class);
SVNLogClient logClient = mock(SVNLogClient.class);
SVNStatusClient statusClient = mock(SVNStatusClient.class);
SVNStatus status = mock(SVNStatus.class);
when(properties.isEmpty()).thenReturn(true);
when(clientManager.getLogClient()).thenReturn(logClient);
when(clientManager.getStatusClient()).thenReturn(statusClient);
when(status.getContentsStatus()).thenReturn(SVNStatusType.STATUS_NORMAL);
when(inputFile.file()).thenReturn(mock(File.class));
when(statusClient.doStatus(any(File.class), anyBoolean())).thenReturn(status);
doThrow(SVNAuthenticationException.class).when(logClient).doAnnotate(any(File.class), any(SVNRevision.class), any(SVNRevision.class), any(SVNRevision.class), anyBoolean(), anyBoolean(), any(AnnotationHandler.class), eq(null));
assertThrows(IllegalStateException.class, () -> {
svnBlameCommand.blame(clientManager, inputFile, output);
assertThat(logTester.logs(LoggerLevel.WARN)).isEmpty();
});
}
use of org.tmatesoft.svn.core.wc.SVNStatusClient in project sonarqube by SonarSource.
the class SvnBlameCommandTest method blame_givenNoCredentials_logWarning.
@Test
public void blame_givenNoCredentials_logWarning() throws Exception {
BlameOutput output = mock(BlameOutput.class);
InputFile inputFile = mock(InputFile.class);
SvnBlameCommand svnBlameCommand = newSvnBlameCommand();
SVNClientManager clientManager = mock(SVNClientManager.class);
SVNLogClient logClient = mock(SVNLogClient.class);
SVNStatusClient statusClient = mock(SVNStatusClient.class);
SVNStatus status = mock(SVNStatus.class);
when(clientManager.getLogClient()).thenReturn(logClient);
when(clientManager.getStatusClient()).thenReturn(statusClient);
when(status.getContentsStatus()).thenReturn(SVNStatusType.STATUS_NORMAL);
when(inputFile.file()).thenReturn(mock(File.class));
when(statusClient.doStatus(any(File.class), anyBoolean())).thenReturn(status);
doThrow(SVNAuthenticationException.class).when(logClient).doAnnotate(any(File.class), any(SVNRevision.class), any(SVNRevision.class), any(SVNRevision.class), anyBoolean(), anyBoolean(), any(AnnotationHandler.class), eq(null));
assertThrows(IllegalStateException.class, () -> {
svnBlameCommand.blame(clientManager, inputFile, output);
assertThat(logTester.logs(LoggerLevel.WARN)).contains("Authentication to SVN server is required but no " + "authentication data was passed to the scanner");
});
}
Aggregations