tags:

views:

57

answers:

2

I've just taken over a large Magento installation with plenty of customizations. I've never used SVN on a project, but I definitely see the benefit of having it. So far, I've managed to create a repository, but I now need to know the process of taking a copy of the current project and getting the SVN setup correctly.

What is the process for doing this? Do I start by checking out a clean copy of Magento? What if there is a version mismatch? And please, details help a lot. I know the benefit of SVN, but have no idea how to actually set it up.

A: 

Moving a site that is in motion is always a bit trickier than doing so for a site that is just starting development. First, take a copy of the most current version of the site (don't use the live version). Delete any cache/session files from the copy and check it into the database. You should now have a complete copy in the database.

Next, you'll need to move a bunch of files and directories over to being ignored. If you're on Windows, I'm told that Tortoise has a good facility to do this. Otherwise, you'll need to actually delete the repo copies of the files, add them to the ignore list, then copy them back into the working copy of the site. See http://stackoverflow.com/questions/2058617/ for some suggestions on what to start ignoring.

Finally, getting it to the live site may be a little harder. If you have full control over the server, check out the version of the site you want into a separate directory, restore files that are ignored for dev purposes (local.xml), and test thoroughly. Now, go do it again, you missed something. Finally, switch Apache over to that directory to serve your requests and you should be running.

Special side note: Make sure to back up the database in the repo and use only development database instances for making changes. Never change live code, never develop on live databases, and you should be pretty insulated from catastrophes.

Hope that helps! Thanks,

Joe


As I type this, I another side note. You may want to have a copy of the clean Magento install for your version handy, to see if the Core has been modified. If it has, shame on the former developer, and you need to look into moving those changes out of the core.

Joseph Mastey
Joe - this is an excellent explanation. Thank you so much, I'll be working on this alongside the other answer to see if I can get this done correctly.
melee
I'm a little confused as to where to start, let me make sure I have this correct; 1. Create repo locally 2. Copy site (not live) 3. Check in copied site (any syntax/process tips for this?) 4. Create repo on live server 5. Test thoroughly, move Apache to that directory. How's my aim?
melee
A: 

I'm not sure what your timeframe is with this, but I would probably make the suggestion to spend a little time in Subversion before jumping right into a SVN + Magento project.

I was in your same shoes about 1.5 years ago and found that even on a clean install, there are hundreds of thousands of files in a Magento project. Then once you start testing loacally Magento creates even more cache, temp, and report (exception log) files which clog things up well.

I found this nice list of files to svn:ignore Just doing that will save you hours of wait time when you're in your final stretch of the project.

Over time, I've realized that a more portable solution (and better for upgrades) is to NOT have Magento itself in your repo. Now I only put modules, themes/interfaces, and assets in the repository.

This makes installs/upgrades/migrations easy because I just download the latest Mage and unpack into Document Root and symlink my modules into the proper locations in the Mage install.

Mike G
Thank you for your insight. I have plenty of time, as the site currently works, but I would like to get it properly setup and operational so it is done right. By your suggestion, I should svn:ignore the majority of the core files (as those aren't going to change anyway), and repo the modules/customizations?
melee