Having downloaded and installed subversion, I’m ready to set it up for use with all of my website code. Since I’m working on a MacBook Pro, I’ll be using Terminal’s command line interface.
The svn-book available from http://subversion.tigris.org/ is a very useful document.
DreamHost supports subversion, so I’ve setup a repository there and a subdomain. I can access it at svn+ssh://firstname.lastname@example.org/home/userid/svn/TRBSource. On DreamHost user’s must be specifically created or granted permission to access Subversion, so I added permissions to my main ID and created a couple additional IDs with subversion permission.
DreamHost FAQs list instructions for setting up credentials to allow accessing the site without specifying password every time (SSH#Passwordless_login). I set this up and provided the password one time. Now my accesses can be done quickly without being prompted for a password each time.
The initial set of files are added to the repository using the svn import command:
cd /Users/Ron/Sites (the documentroot folder on my MBP)
svn import newrockband2 svn+ssh://email@example.com/home/userid/svn/TRBSource -m “Initial import”
During the process a message is displayed indicating each file being added.
I can now ‘list’ the files using:
svn list svn+ssh://firstname.lastname@example.org/home/userid/svn/TRBSource
to verify that everything is there. The list shows that ‘application/’, ‘public/’, and ‘tests/’ folders were added. These are the contents of my ‘newrockband2’ folder. The folder itself was not added.
So now I rename the original newrockband2 folder, create a new one, and creating a working copy in the new folder using ‘svn checkout …’ on all 3 directories (from within the new directory).
Ok, so now I realize that this isn’t the layout that I really wanted. I didn’t create the recommended ‘trunk’, ‘branches’, and ‘tags’ directories first. So I’ll need to create these directories, and then move my new directories to trunk/. So a quick check with ‘svn help’ shows ‘move’ and ‘mkdir’ commands (among others). ‘svn help mkdir’ and ‘svn help move’ give info on using these commands. However, I’m get an error when trying to use mkdir telling me that I haven’t setup environment variables to display/edit log messages. So for now I’m going to leave it alone. I’ll add/move those later.
First of course I make sure that my backups are up-to-date. I’m using Time Machine, so I verify that it has completed a recent backup. Now I’m going to cleanup my Sites folder, deleting a lot of old stuff (it’s backed up, right?), then check-out the code I just put there.
Having previously installed SCPlugin, now when I look at my newrockband2 folder in Finder I see green checkboxes next to the directories 🙂
However, browsing to the new copy displays an error message complaining that it cannot open the log.txt file. So I locate the log file and change permissions ‘chmod 777 log.txt’ and all appears to be well now.
Now I need to check out the code to the live site (new.therockband.org). This is described in http://wiki.dreamhost.com/Subversion#Gotchas. So I SSH into the site (ssh email@example.com):
svn checkout http://svn.therockband.org
Browsing to the site now, I see that the DB path is incorrect (127.0.0.1). The APPLICATION_ENV is specified in the .htaccess file, so I edit it using pico. There appears to still be an error, which I’ll investigate tomorrow. But for now it appears that Subversion is working, and can directly update live site. Tomorrow I’ll investigate using it to deliver to a test site also.