Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion & switching between tags

Tags:

svn

tags

My automated deployment system updates a latest version of my site trough subversion. Instead of having my live site point to the trunk (which is always almost a work in progress version), I have my live site point to a tag.

E.g. I work on trunk and when my v1.0 is finished I create a tag called 1.0 and do a checkout of that tag which is then my live site. Now, I keep working on trunk and after a while there is a v2.0. I create a tag called 2.0 and I want my live site to resemble this 2.0 tag.

I could wipe the current live site and do a checkout of this 2.0 tag. Which sounds easy enough, however. My site is about 1GB is size because it has all kinds of PDF documents and video in it. I can safely say that most of the time I do updates it will be copy changes or bug fixes. This means that maybe only 1% of my site changes per update. And since my version control is only accessable to my webserver through on off site http connection it would mean that I need to download that whole site over and over again.

Is there an easy way to switch between tags and have subversion only update the differences between those tags?

like image 206
Luke Avatar asked Oct 10 '08 21:10

Luke


3 Answers

There actually is a switch function that does just that. I use TortiseSVN which is a windows shell/gui for Subversion, so I'm not familiar with how to do it manually, but this looks like it should help:

http://svnbook.red-bean.com/en/1.1/ch04s05.html

like image 192
Davy8 Avatar answered Nov 19 '22 06:11

Davy8


Command line: svn switch URL

Use svn help switch for more detail.

However, I recommend doing things the other way around. Your production site is always on trunk, while you do your development on branches which get merged back to trunk when they're ready for release. After any given release, you can then do a tag for historical purposes. After the merge, you have only to do a svn update to get your site running the new code.

DivMod takes this idea to its logical conclusion, creating a branch for each issue/ticket being worked. You can read their description of their system; it offers some convincing arguments.

like image 39
kbluck Avatar answered Nov 19 '22 06:11

kbluck


I use a similar setup, except I use a live branch, rather than a tag. It's more work to commit, since I now have to merge changes from trunk into the live branch, but I can then just do an "svn up" in the webroot to update it. It also gives me slightly better control if I want to merge selected changes from different branches into live.

If I was doing it again, I'd use mercurial (or similar) since branches are much easier to maintain, but the above technique has worked for 3 live sites for about two years now.

like image 1
Draemon Avatar answered Nov 19 '22 08:11

Draemon