※版本管理※=>☆SVN工具☆=>※№ TortoiseSVN 设置文件夹链接

问题:
       我们的项目里,服务器脚本工程svn地址为:svn://server/script;配置文件地址为:svn://server/cfg。都是独立的仓库。有一天,对外发布人员觉得每次都Update两次很烦,说能否把类似这种目录都放在一个仓库里,只需要Update一次就可以了。
       是否所有资源、代码都用一个仓库就ok了呢?千万不要这么做,因为
        svn的效率很低!
 
  svn在管理代码这种文本文件(而且相比美术资源体积不大,文件不算多)的时候,下载、上传、查上传log速度还是可以接受的。我们已经做了多年的仓库依然能应付过来。
    但是管理二进制文件的时候,速度实在是慢的令人发指,角色、场景这种容量、文件数比较夸张的目录,完全下载一次甚至可以用掉4个小时。随着时间流逝,历史记录越来越长,下载速度就越来越难以容忍了。

解决方案:
  
 把不同种类的资源放在不同的仓库里,具体怎么放可以由有经验的资源管理人员安排。然后,建立一个资源主干仓库。里面用文件夹链接的形式,存放各种资源。

    资源管理员一旦设置好svn:externals属性之后,对用户来说,上传、下载都没有区别,就好像文件夹真的在主干仓库里一样。
    等过了一段时间,例如半年,某一种资源太多需要清理的时候。管理员把现有资源干净的拷贝出来到新仓库(或者新目录),例如cha目录下所有文件拷贝到cha2目录,只要最后的结果文件不要svn信息。然后修改svn文件夹链接的地址。
    修改好后,用户直接使用就ok了。达到了不影响其他人员的同时优化svn速度的目的。

    (仅试验过,还没有在项目里实用,最后一步用户更新时可能会有冲突)


TortoiseSVN操作方法:右键->TortoiseSvn Properties->如下图编辑



Subversion provides a natural way to pull together resources from different parts of one or more subversion repository locations into a single working folder.  Once setup the commits are pushed into correct parent locations and updates are pulled from the initially configured urls.  This mechanism works equivalent to the symbolic links.  Here is an example.

Step 1:

Create a folder ./externals

Step 2:

Add the new folder into repository using command,

svn add ./externals

Step 3:

Create a file “externals.txt” with these two lines

tomcat/bin http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/bin
apacheds/resources http://svn.apache.org/repos/asf/directory/apacheds/tags/1.5.7/resources

Step 4:

From command line run the following command.

svn propset svn:externals ./externals -F externals.txt

You are all set.  Any updates on externals folder (after committing the newly created folder) will fetch you the latest from tomcat/trunk and apacheds/tags/1.5.7/resources.  What the command has done is to set a property names ‘svn:externals’ into the folder metadata of folder ‘externals’ that tells svn client that some of its child folders are to be fetched/updated/committed through a different repository location.

  If you change any parts of the “externals” code, you will be able to check it in right into the correct code-base.  This solution avoids potential mess ups involving code base mash-ups.

One flipside of this solution is that while branching or tagging you will need to be extra careful in case your symbolic links also needs to shift.  To this effect it is worth noting that there are other useful commands for managing svn folder properties.  Check out the documentation here.


举例:
1:如果需要在  test 目录下,增加 comlibs 目录的链接文件,链接到 http://192.168.1.35/svn/media/software/comlibs/ 路径
则  externals.txt  文件内容如下所示:
  comlibs http://192.168.1.35/svn/media/software/comlibs/

2:再把 externals.txt   文件放到 test 目录的平级位置,如
      │   ├── 1 
      │   │   ├── test 
      │   │   │   ├── buffer.c
      │   │   │   ├── buffer.h
      │   │   │   └── Makefile
      │   │   ├── externals.txt

3:在 目录 1 下执行如下命令
     svn propset svn:externals dvs -F externals.txt

4:提交修改属性
     svn  ci -m "modify"

5:更新,下载 comlibs 目录
    svn  update 

6:最后目录如下所示
      │   ├──  1 
      │   │   ├──  test 
      │   │   │   ├── buffer.c
      │   │   │   ├── buffer.h
      │   │   │   └── Makefile
      │   │   │   └──  comlibs
      │   │   ├── externals.txt
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值