Manuals

包含一个普通的子项目

Sometimes you will want to include another project within your working copy, perhaps some library code. There are at least 4 ways of dealing with this.

使用 svn:externals

Set the svn:externals property for a folder in your project. This property consists of one or more lines; each line has the name of a sub-folder which you want to use as the checkout folder for common code, and the repository URL that you want to be checked out there. For full details refer to “外部条目”一节.

Commit the new folder. Now when you update, Subversion will pull a copy of that project from its repository into your working copy. The sub-folders will be created automatically if required. Each time you update your main working copy, you will also receive the latest version of all external projects.

如果外部项目位于同一版本库,当你提交你的主要项目时,你在这儿所做的任何更改都将包含在提交列表中。

If the external project is in a different repository, any changes you make to the external project will be shown or indicated when you commit the main project, but you have to commit those external changes separately.

在已述的三种方法中,这是唯一不需要在客户端设置的方法。一旦在目录属性中指定了外部资源,所有客户端在更新时都会创建相应的目录。

使用嵌套工作副本

Create a new folder within your project to contain the common code, but do not add it to Subversion.

在新目录下选择 TortoiseSVN检出,在其中检出普通代码的副本,现在你在主要的工作副本有了一个独立的嵌套的工作副本。

两个工作副本是独立的,当你在父目录提交修改,嵌套的工作副本会被忽略,同样当你更新你的父目录,嵌套的工作副本不会被更新。

使用相对位置

If you use the same common core code in several projects, and you do not want to keep multiple working copies of it for every project that uses it, you can just check it out to a separate location which is related to all the other projects which use it. For example:

C:\Projects\Proj1
C:\Projects\Proj2
C:\Projects\Proj3
C:\Projects\Common
        

and refer to the common code using a relative path, e.g. ..\..\Common\DSPcore.

If your projects are scattered in unrelated locations you can use a variant of this, which is to put the common code in one location and use drive letter substitution to map that location to something you can hard code in your projects, e.g. Checkout the common code to D:\Documents\Framework or C:\Documents and Settings\{login}\My Documents\framework then use

SUBST X: "D:\Documents\framework"
        

to create the drive mapping used in your source code. Your code can then use absolute locations.

#include "X:\superio\superio.h"
        

这个方法职能工作在完全PC的环境,你所做的就是记录必须的磁盘映射,所以你的团队知道这些神秘文件的位置,这个方法只能用于紧密地开发环境,在普通的使用中并不推荐。

增加此项目到版本库

The maybe easiest way is to simply add the project in a subfolder to your own project working copy. However this has the disadvantage that you have to update and upgrade this external project manually.

To help with the upgrade, TortoiseSVN provides a command in the explorer right-drag context menu. Simply right-drag the folder where you unzipped the new version of the external library to the folder in your working copy, and then select Context MenuSVN Vendorbranch here. This will then copy the new files over to the target folder while automatically adding new files and removing files that aren't in the new version anymore.

TortoiseSVN homepage