Show messages from native scm protocol

This commit is contained in:
René Pfeuffer
2020-11-10 08:33:22 +01:00
parent b2533db684
commit 01a5dbd091
14 changed files with 202 additions and 24 deletions

View File

@@ -27,6 +27,7 @@ package sonia.scm.repository.spi;
import org.apache.shiro.SecurityUtils;
import org.tmatesoft.svn.core.SVNCommitInfo;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNWCClient;
@@ -40,9 +41,14 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.regex.Pattern;
import static sonia.scm.repository.spi.IntegrateChangesFromWorkdirException.withPattern;
public class SvnModifyCommand implements ModifyCommand {
public static final Pattern SVN_ERROR_PATTERN = Pattern.compile(".*E" + SVNErrorCode.CANCELLED.getCode() + ": (.*)");
private final SvnContext context;
private final SvnWorkingCopyFactory workingCopyFactory;
private final Repository repository;
@@ -81,7 +87,7 @@ public class SvnModifyCommand implements ModifyCommand {
);
return String.valueOf(svnCommitInfo.getNewRevision());
} catch (SVNException e) {
throw new InternalRepositoryException(repository, "could not commit changes on repository");
throw withPattern(SVN_ERROR_PATTERN).forMessage(repository, e.getMessage());
}
}