今天在使用TortoiseSVN合并代码时,遇到了获取mergeinfo不支持的问题,具体出错截图:
以前合并也没有遇到过这个问题啊,Stack Overflow一下,看到说是本地SVN版本是服务器SVN版本不一致,服务器版本低导致无法获取,在里面,回答者给出了升级服务器SVN版本的方法:
The problem is the repository format version, which is not automatically updated when the server is.
I have admin access to the repository, so checking
<path_to_repo>/db/format
showed2
which corresponds to server version 1.4. I backed up the repository:svnadmin dump| gzip > afullrepobackupname.svn.gz and upgraded it:
svnadmin upgradeNow
<path_to_repo>/db/format
contains:4layout linearwhich corresponds to server version 1.6 (3 would be 1.5).
Now my TortoiseSVN can 'Merge - Reintegrate a branch' successfully.
不过很显然我是没有服务器的权限的,这个方案pass。
折腾了一下午,SVN本地版本换了好几个也不行,突然想起以前合并其实是使用的某些版本号合并的,而我这次却是使用的全量也就是整个文件夹合并,试了一下,果然指定版本号即使是区间版本号合并也是没有问题的,然后想起了前面在Stack Overflow看到的这个里说:
When merging, >=1.5, clients can do merge-tracking - basically find the revision when the last merge was done. Merge-tracking information is stored in the svn:mergeinfo property by the client when it performs a merge and once the merge is done, it is stored by the server. So when a new merge is done, the client expects to get this mergeinfo from the server.
In older servers, you have to explicitly mention the revision that you last merged ( or branched)
svn merge svn://server/repo/trunk@revision svn://server/repoo/branch .Or use older client.
也就是说碰到这个情况有三种解决办法:
1:升级服务器SVN版本,使客户端服务器版本一致
2:降级客户端版本,使版本一致
3:版本不一致,但是明确指定需要合并的版本
公司里面实际上根本看不到服务器的SVN版本,因此也就只能使用第三个方法了╮(╯▽╰)╭