Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN Checkout a single directory

Here is my dilemma:

I want to checkout a single directory (let's call it A) from SVN, but be able to do and svn up A from the parent directory on the computer is checked out on.

i.g. I am on in ~/coolstuff I want do do a checkout of A and put it in ~/coolstuff and when I am in ~/coolstuff I want to issue svn up and have it update A.

Here is a trick to do this in a basic scenario: In SVN A's parent directory is Z. I do an SVN checkout of Z in ~/coolstuff. I then mv ~/coolstuff/Z/.svn to ~/coolstuff. Walla I can do a svn up and it works and it will pull down A inside of ~/coolstuff.

My scenario: I do the same thing above, except the problem is that Z not only has the child A, but it also has the child B. So a svn up in ~/coolstuff will pull down A and B. But I don't want B to be pulled down.

Here is the solution: I edit ~/coolstuff/.svn/entries and removed the reference to B. Now svn doesn't see B, only A.

The solution above still initial pulls down A when I do the first checkout, I don't want to do this. It also seems very hack-ish. Is there a better/cleaner way to do this, and hopefully not have to pull down "B" at all?

like image 965
MrD Avatar asked Aug 31 '11 22:08

MrD


1 Answers

I think this is what you want to do:

svn co --depth empty file://path/to/A-B/parent coolstuff
cd coolstuff
svn up A

Now you can do an svn up from within coolstuff to update A without pulling in B automatically.

like image 127
xn. Avatar answered Oct 06 '22 18:10

xn.