Wednesday, June 24, 2009

Subversion on MediaTemple (dv)

Just completing some upgrades to my service to incorporate subversion. I don't know how I got by without it for so long. My first exposure to version control software was Visual SourceSafe back in the dark ages, and since then I've either used that or similar routines involving backups and multiple versions in similarly-named folders. Subversion is a lean, command-line, open-source version of the same. Here's what I did.

In the case of MediaTemple, Subversion is already installed. All you have to do to get started is invoke a new instance on the command line.

svnadmin create /name/of/project/folder

Then build a project to import into svn, such as

tmp/project/trunk
tmp/project/branches
tmp/project/tags

Jump into the trunk and add some files to it

file1
file2
file3

When you import the project, subversion vacuums it all up.

svn import /tmp/project file:///name/of/project/folder -m "initial import"

Note the -m, ensures you won't get an error for not setting the default text editor for subversion. In case you would like to set it, just use the command:

export SVN_EDITOR=vi

Now you can checkout files using the checkout command

svn checkout file:///name/of/project/folder/trunk project

And you can post your revisions using commit

svn commit

Notice the difference in directory structure between creating, importing and checking out. Creating and importing require only the folder, but checking out requires the additional trunk folder and project name specified.

Here are some additional resources of note for subversion installations, with an emphasis on MediaTemple (dv) installations.

Ayman Hourieh Subversion Tutorial - quick and to the point.

Tony Spencer's Tutorial - includes basic WebDAV integration, also quick and to the point.

No comments: