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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.