Dumb Subversion question (single repository, multiple projects)

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Does anyone here know a lot about Subversion? i'm using it to manage projects at work. We have 5 projects in the same repository. All of these projects "live" on the same servers (test server + live server).

My question is: if I run svn update on the live server, will it update all of the projects or just the folder I'm in?

I think it sould just update the project I'm in, but I want to make sure I don't screw everything up. Before I got here they had all the projects in subversion but weren't using it to update the versions on the server. Not sure why that was - seems to me that it would make much more sense to just run svn update rather than copying & pasting everything! Isn't that how it's supposed to work?

They have: 121 posts

Joined: Dec 2008

Issuing an 'svn update' will only update the directory you are in, as well as all sub (child) directories.

Whether this is best practice or not can probably be argued either way. I've not had a problem with it, though beware you are updating to the right tag/release - HEAD isn't always where you want to be updating in production. (learned the hard way...)

Cheers,
Shaggy

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Yes, subversion is a great way to organize web projects, especially when going between a test and live environment.

My question is: if I run svn update on the live server, will it update all of the projects or just the folder I'm in?

It depends on what you checked out. If you only checked out a sub directory, then that's only what will update when you run an SVN update. Tt doesn't necessarily depend on what directory you are in. If you checkout a folder called /twf/, and you are 'in' a subdirectory of /twf/tags/1.5/, and you run svn update, it will update all of /twf/ because that's what you have checked out.

seems to me that it would make much more sense to just run svn update rather than copying & pasting everything! Isn't that how it's supposed to work?

Yes, every working copy of the website is a 'checkout'. For example, I checkout a copy to my local computer to work on the site, and I also checkout a working copy to my test server and production server. I make changes to my local copy and run svn commit. Then, push the updates to the test server by running svn update on the test server. Once I'm satisfied with the test site, I run svn update on the production server.

I used to have all my web projects in one repository, but I have decided that having a separate repository for each project is a better idea. Mainly because the revision history & notes is all mixed up because you are posting revisions for different projects. And if your database gets screwed up, all of your projects suffer.

Some articles that have helped me:
http://athleticsnyc.com/blog/entry/on-using-subversion-for-web-projects
http://www.sitepoint.com/blogs/2006/02/07/using-svn-for-web-development/

They have: 121 posts

Joined: Dec 2008

Yes! A step sometimes forgetten - the project has to be checked-out on the file system you want to execute an svn update from.

Maybe I misunderstood the question - I thought Megan was asking:

If I've checked out 'projectName', and want to just update a sub directory of that project could I:

$ cd projectName/library/somefolder
$ svn update

And it would only update 'somefolder' and it's child directories.
It has been my experience (And I just tried it out, just to be sure) that this holds true. If a file was added/edited/deleted in, say projectName/model, those changes won't show up after executing the svn projectName/library/somefolder, only changes in projectName/library/somefolder and above.

Cheers,
Shaggy.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.