Creating an SVN View Repo
Situation: I have a project that requires data from several different SVN repositories. The projects are related, and the repositories are large, and I don’t want to grab everything—and I don’t want the pieces that I do grab sitting in different directory trees. Instead, I’d like a single tree with a view of the directories that I need—and nothing else.
I can do this with SVN externals.
I got the answer for how to do it from here. So props to Artem Russakovskii, the author of the blog.
Here’s my test. I decided to grab segments of two different repos, and put them in different places. First: two pieces of a single repo. Then a piece of another.
1. I went to Unfuddle, my SVN host, and created a new repository: dtrace1
2. I created a local directory and checked it out:
svn checkout http://<path_to_repo> .
Remember the dot at the end! 3. I created a file externals.txt
sub1/host http://<path_to_repo>/<path_to_host_dir>
sub1/silly/notes http://<path_to_repo>/<path_to_notes_dir>
This will put the contents of the host dir in sub1/host; the contents of the notes dir in sub1/silly/notes
None of the directories existed.
4. I processed the externals with:
svn propset svn:externals -F externals.txt .
5. I pushed externals.txt and the processed externals definition to the repository with
svn commit –m “created externals”
6. Then I did
svn checkout
And voila! The two directories appeared just where they were supposed to.
7. Then I added this line to externals.txt
sub3/src http://<path_to_second_repo>/<path_to_src_dir>
to get the contents of the src directory in a second repo.
Then I repeated:
- svn propset svn:externals –F externals.txt
- svn commit –m “added a second repo”
- svn checkout
The first two directories were skipped because they were up to date, and the new one was created.
Sweet!
Comments
Post a Comment