我有一个工作目录,trunk
想将其切换到指定的分支。我怎样才能做到这一点?
我想要一个方法
public static void switchToBranch(File baseDir, String branchUrl){
}
我怎么能实现呢?
[更新]更好的版本:
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 在标签、分支或任何其他路径之间没有区别)