使用 Java 自动提交目录树到 SVN
我想要使用 java 工具自动提交带有文件的目录树到 svn 。
有 shell 和 bat 脚本
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
它们可以工作,但我想要这些脚本的 java 实现(例如 ANT 脚本)。 有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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SVNKit 是一个纯 Java SVN 库。我确信使用 SVNKit 您可以用 Java 重新实现脚本。
小心进行通配符添加(或显式脚本化添加),因为它们会绕过 svn:ignore 和全局忽略。
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.