Treating my repository as a SVN repo, I get:
svn co http://myrepo/foo/trunk foo
...
foo/
bar/
baz/ -> http://myrepo/baz/trunk
Treati
The solution I ended up using was just to symlink to other git-svn
clones on my local box. This worked pretty well: it allows me to commit changes back, and it allows me to make local changes on project A just to get them into project B.
I decided to write a "simple" perl script to handle all this stuff for me. I've put it recently to github, try it out, maybe it would help: http://github.com/sushdm/git_svn_externals/.
It essentially does git-svn clone for all externals found, and it looks for them recursively, clones, symlinks them in proper places and excludes all .git_externals dirs and symlinks so that you can still use 'git svn dcommit'.
Good luck.
Just for the record: I followed this suggestion and tried using SmartGit for dealing with svn:externals
.
SmartGit is by far the best GUI client I've ever seen for Git. Regarding svn:externals
, it not only correctly fetches them, but also presents the option of doing a "fast snapshot" (read-only, HEAD-only clone) of external repositories.
Unfortunately it is not free for commercial use (and I found the license price a little bit too high - yes I'm a cheapskate). It may be used for free for non-commercial purposes though.
The best means of integrating svn externals with git-svn that I've seen is this script, which clones your externals into a .git_externals/ directory and creates the symlinks and exclude files you need. I find this a simple and direct solution. YMMV.
Here is an older overview of other options for dealing with svn externals with git-svn. To me they look a little over-complicated and liable to break under subsequent Git use.
I also made a script (both Perl and Ruby variants available) that does this for me, it's at http://github.com/liyanage/git-tools/.
Update: I am no longer maintaining this script. Its functionality for recursively cloning and updating an SVN repository, as well as other git-related features, is available in this newer project that I am actively maintaining: http://liyanage.github.com/git-tools/
I just wrote a short script which checkouts all svn:externals
of the current HEAD
to the root directory and excludes them from the git repository.
Place it to .git/hooks/post-checkout
and it will keep those external checkouts up to date whenever the working tree changes, for example due to git svn rebase
or git-checkout
.
#!/bin/bash
set -eu
revision=$(git svn info | sed -n 's/^Revision: \([1-9][0-9]*\)$/\1/p')
git svn -r${revision} propget svn:externals | head -n-1 | {
while read checkout_args
do
checkout_dirname=$(echo ${checkout_args} | cut -d' ' -f3)
svn checkout ${checkout_args}
if [ -z $(grep ${checkout_dirname} .git/info/exclude) ]
then
echo ${checkout_dirname} >> .git/info/exclude
fi
done
}