I'm looking for a succinct and well-written tutorial on using svn:externals.
I already know how to use them in a basic way myself, but I want a good article that I can link to when answering questions like this one that come up recently:
What to do with multiple projects depending on the same source?
I'd do it myself, but I don't use them often enough to want to stick my neck out and write a tutorial on it. Google was surprisingly unhelpful with this topic.
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