I have a working directory in trunk
and would like to switch it to a specified branch. How can I do that?
I'd like to have a method
public static void switchToBranch(File baseDir, String branchUrl){
}
How could I implement that?
I have a working directory in trunk
and would like to switch it to a specified branch. How can I do that?
I'd like to have a method
public static void switchToBranch(File baseDir, String branchUrl){
}
How could I implement that?
[Update] Better version:
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);
}
Credentials are apparently automatically picked up from the ~/.subversion directory.
(And of course it doesn't have to be a branch, SVN doesn't make a difference between tags, branches or any other path)