我在trunk
中有一个工作目录,并希望将其切换到指定的分支。我怎么能这样做?
我想要一个方法
public static void switchToBranch(File baseDir, String branchUrl){
}
我该如何实现?
答案 0 :(得分:3)
[更新] 更好的版本:
public static void switchToBranch(final String branchUrl,
final File basedir,
final ISVNDebugLog log) throws SVNException, IOException{
final SVNUpdateClient updateClient =
SVNClientManager
.newInstance().getUpdateClient();
if(log != null) updateClient.setDebugLog(log);
updateClient.doSwitch(basedir,
SVNURL.parseURIEncoded(branchUrl),
SVNRevision.HEAD,
SVNRevision.HEAD,
SVNDepth.INFINITY,
false,
false);
}
证书显然是从〜/ .subversion目录中自动获取的。
(当然它不一定是分支,SVN在标签,分支或任何其他路径上没有区别)