SVN的switch命令



语法就不说了,文档有的是,主要是两个常用的用法:

1. 切换资源库(svn sw --relocate)

[plain] view plaincopy
svn sw --relocate <from_url> <to_url> [PATH]  
例子:
[plain] view plaincopy
svn sw --relocate https://mysvn.cn/svn/old https://mysvn.cn/svn/new .  
(注意最后有个点“.”,代表当前目录,其实可以不打,不打默认表示当前目录)
这个意思就是说从https://mysvn.cn/svn/old这个资源库切换到https://mysvn.cn/svn/new。

注意,这里有且只有可以切换资源库,而不是切换分支!

什么是资源库呢?敲“svn info”看到“Repository Root”就是喇,用--relocate的时候就只能切换这段,要不然会提示错误的。


2. 切换分支(svn sw)

[plain] view plaincopy
svn sw <branch_full_url>  
例子:
[plain] view plaincopy
svn sw https://mysvn.cn/svn/repo/project/branches/version-xxx  
同上面例子类似,后面点省略了。这样就能来回切换分支。
但是这样有时候在某些软件checkout下来的working copy上会提示资源库不正确,解决办法如下:

照样是svn info看看信息,有时候“Repository Root”是这样的格式

“https://username@mysvn.cn/svn/repo”
这个时候有两种办法

一是使用“svn sw https://username@mysvn.cn/svn/repo/project/branches/version-xxx”切换

二是先通过"svn sw --relocate https://username@mysvn.cn/svn/repo https://mysvn.cn/svn/repo“来切换资源库,然后再切换分支
原文地址:https://www.cnblogs.com/wangjiyuan/p/switch.html