Friday, June 13, 2014

Checking out just a little with Subversion

We have a huge source tree in subversion and I don't want the whole thing on my laptop. There is a top-level trunk directory and then project directories within it, and I only want a few of those project directories. Ordinarily I would just check out the individual ones I want separately, but this leaves them unrelated and when you have to make changes to multiple projects and want check them in all at once with a single commit you simply cannot. The alternative, checking out the entire trunk, seems to be a bit excessive as well. Luckily there is another alternative: checking out the root directory with a depth of empty, and then updating only the subdirectories/projects that I want within that directory.

Here is an example: I have a root directory of trunk and within trunk there are subdirectories with project1, project2, and project3. I want to check out project1 and project3, but I don't need project2 right now and would rather not have it. So the first thing I do is check out the root directory:

svn checkout --depth empty http://myserver/subv/repository/trunk/

Then I have a new local directory called trunk. I move into that directory:

cd trunk

Then I can get just the subdirectories I want with an update:

svn update project1
svn update project3

Now I have just the structure I want. When I do an update or a commit within the trunk directory, I encompass all of these projects and no others and I am free to commit the changes in multiple projects under a single commit.

No comments:

Post a Comment