Search code examples
javasvnautocommit

Auto-commit directory tree to SVN with Java


I want autocommit directory tree with files to svn with java tool.

There are shell and bat script

bat

for /f "tokens=2*" %%i in ('svn status %1 ^| find "?"') do svn add "%%i"
for /f "tokens=2*" %%i in ('svn status %1 ^| find "!"') do svn delete "%%i"
svn commit -m "Automatic commit" %1

bash:

#!/bin/bash

echo "processing files to add..."
svn status | grep “^?” | sed -r ’s/^\?[ ]+//’ | xargs -r svn add

echo "processing files to delete..."
svn status | grep “^!” | sed -r ’s/^\![ ]+//’ | xargs -r svn delete

echo "processing commit..."
svn commit

They works, but I want java implementation for these scripts (ANT script, for example). Is there java implementation?


Solution

  • SVNKit is a pure Java SVN library. I'm sure using SVNKit you could re-implement your scripts in Java.

    Be careful doing wildcard adds (or explicit, scripted adds), as they will bypass svn:ignore and global ignores.