Demo:
/**
* 2019年6月21日下午6:24:02
*/
package testsvn;
import java.io.IOException;
/**
* @author XWF
*
*/
public class TestSvn {
/**
* @param args
*/
public static void main(String[] args) {
try {
Process proc = Runtime.getRuntime().exec("cmd.exe /c svn add \"E:/svn资源位置/需要添加的文件夹或文件\"");//需用\"转义
proc.waitFor();
System.out.println("finished add");
Process proc2 = Runtime.getRuntime().exec("cmd.exe /c svn commit -m \"提交日志\" \"E:/svn资源位置/需要添加的文件夹或文件\"");
proc2.waitFor();
System.out.println("finished commit");
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
参考:https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-cli-main.html