Throw NoChangesMadeException for empty commits in SVN repositories

Committed-by: Florian Scholdei <florian.scholdei@cloudogu.com>
This commit is contained in:
Eduard Heimbuch
2023-08-07 23:17:25 +02:00
parent 8cafeefc74
commit 33e8d30b62
4 changed files with 17 additions and 1 deletions

View File

@@ -29,7 +29,6 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tmatesoft.svn.core.ISVNLogEntryHandler;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNLogEntry;
import org.tmatesoft.svn.core.io.SVNRepository;

View File

@@ -35,6 +35,7 @@ import org.tmatesoft.svn.core.wc.SVNWCClient;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
import sonia.scm.ConcurrentModificationException;
import sonia.scm.ContextEntry;
import sonia.scm.NoChangesMadeException;
import sonia.scm.repository.InternalRepositoryException;
import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnWorkingCopyFactory;
@@ -112,6 +113,9 @@ public class SvnModifyCommand implements ModifyCommand {
true,
SVNDepth.INFINITY
);
if (svnCommitInfo.toString().equals("EMPTY COMMIT")) {
throw new NoChangesMadeException(repository);
}
return String.valueOf(svnCommitInfo.getNewRevision());
} catch (SVNException e) {
throw withPattern(SVN_ERROR_PATTERN).forMessage(repository, e.getErrorMessage().getRootErrorMessage().getFullMessage());