如何开始使用 svn: 外部性?

我正在寻找一个简洁和良好的教程使用 svn: 外部。

我自己已经知道如何以一种基本的方式使用它们,但是我想要一篇好的文章,当我回答最近出现的这样的问题时,我可以链接到这篇文章:

如何处理依赖于同一来源的多个项目?

我想自己做,但是我不经常使用它们,以至于我不想冒险写一篇关于它们的教程。令人惊讶的是,谷歌在这个问题上毫无帮助。

84801 次浏览

Here are some sections about it in the svnbook / TortoiseSVN manual:

This is the svnbook page on svn:externals. It is the most useful resource on the subject.

This one explains four ways to include sub-projects in the workflow (and in the process misses a fifth one: symlinks).

And this last one is a TortoiseSVN-specific page on how to import stuff in a repository (not directly related to svn:externals).

In case it isn't clear from the links provided above, the way you set the svn:externals property that is tied to a particular revision (pinning), here it is:

svn propset svn:externals "plugins -r12345 https://svn.example.com/common/plugins" extras

That will will make a plugins subdirectory under the extras directory and link it to revision 12345 of the external SVN URL https://svn.example.com/common/plugins.

There is a Red Bean article that suggests using propedit since the svn:externals can be a multi-line value. The above example would be changed as follows to use propedit.

svn propedit svn:externals extras

You would then add one line for each external link following the same format shown above for the value.

root/repo1/proj/base/common/log.c
root/repo1/proj/base/common/log.h
root/repo1/proj/base/client


root/repo2/proj/test/base

As show above, we want to copy 2 files and 1 directory to repo2

Step1

directory: /home/jack/repo2/proj/

cd /home/jack

Step2

svn propset svn:externals "../repo1/proj/base/client proj/base/client" repo2

something like: ln repo1/proj/base/client repo2/proj/base/client

Step3

export SVN_EDITOR=vim

Step4

svn propedit svn:externals repo2

vim shows :

../repo1/proj/base/client proj/base/client

Step5: add another two files

../repo1/proj/base/client proj/base/client
../repo1/proj/base/common/log.c proj/base/common/log.c
../repo1/proj/base/common/log.h proj/base/common/log.h