Subversion
There are many "Source Control Systems" around (check in http://en.wikipedia.org/wiki/Revision_control).
And from the comparison chart in http://en.wikipedia.org/wiki/Comparison_of_revision_control_software, none handles "binaries" nicely as it would be useful for Director development.
Why subversion of all of them? Well, it's a question of preference actually, choose what you want, install it and use it. It doesn't matter. Just use one! You will appreciate this recommendation the sooner you get one running.
Subversion is available on loads of environments, and you don't need to install it on the build machine, so you can opt for the "base" operating system of your preference.
A current trend for installing this kind of solutions is by use of virtualization (Xen, VMWare, etc).
Contents
Windows
Install and Configuration
- Install
First you need to download the correct file to install. All installers/packages are located in:
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91&expandFolder=91&folderID=8100
The file we need is the installer:
Run it...
When installing, choose the correct bindings (in our case, choose Apache 2.2. branch).
Apart from that, is just... next... next... next... until it finishes.
And congratulations you have installed subversion on your machine.
- Test
To test it, just open a command prompt (Start | Run | type: cmd and press ENTER), and type in it:
svn ENTER
It should answer with: "Type 'svn help' for usage."
Go to an empty directory (create it, so you can delete it after the test). Inside it, type
svn checkout http://svn.collab.net/repos/svn/trunk/
It should start to add a list of files... You can cancel this operation by pressing Ctrl+Break and delete the test directory.
If it doesn't work out, check the error message and the svn book, because normally failures at this point means that some sort of network issue is going on (normally firewalls).
- Create the repository
There are several strategies for handling projects. Some people are fine with only one repository for all the projects, others prefer one repository for each project. Choose the strategy that you are comfortable with, and set the repositories as needed.
To create a repository, first create the directory where it's files will be stored, then open a command prompt, and in it type:
svnadmin create myrepos
This will create the repository myrepos inside that empty directory.
This repository is already prepared to use with the command line tools, but it's better to use the webdav interface.
- Configure Apache Webdav
In "C:\Program Files\Subversion\bin" you will find the files "mod_dav_svn.so" and "mod_authz_svn.so". Copy them to "C:\Program Files\Apache Software Foundation\Apache2.2\modules"
Edit the file "C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf".
Change the line from:
- LoadModule dav_module modules/mod_dav.so
To
- LoadModule dav_module modules/mod_dav.so
and add a line:
LoadModule dav_svn_module modules/mod_dav_svn.so
to the end of the LoadModule block.
Add in the end the following statements:
<IfModule dav_svn_module>
<Location /svn/myrepos> DAV svn SVNPath c:/path/to/directory/myrepos </Location>
</IfModule>
Notice that the path here is the full directory. If you created a directory called "myrepos" in "c:\", then moved inside and typed the create command as "svnadmin create myrepos", then the path will be "c:/myrepos/myrepos".
Restart Apache.
- Test Apache Webdav
Surf to http://localhost/svn/myrepos/ and make you should be looking at a "Revision 0" notice at the top with the svn engine signature on the bottom.
In that case, subversion is working and will run any time Apache Web Server is running. This means that if you change Apache to run as a service, you don't need to log with an account in the windows box for it to work.
Note: Tested on Windows Vista with success (both apache and svn running).
Sources
- http://blogs.vertigosoftware.com/teamsystem/archive/2006/01/16/Setting_up_a_Subversion_Server_under_Windows.aspx
- http://blog.excastle.com/2005/05/31/mere-moments-guide-to-installing-a-subversion-server-on-windows/
- http://better-scm.berlios.de/subversion/Svn-Win32-Inst-Guide.html
Client
- Clients for Subversion:
Mac OS X
Install and Configuration
On MacOSX Leopard (10.5 and higher) Apache2 and Subversion are already installed and almost ready to use. (The version of subversion is 1.4.4, if you want a newer version use the below link to Martin Otts package).
There is just one small tweak to make to the apache config file located at: /etc/apache2/httpd.conf open that file and add (or uncomment) the following line (dunno, why it is NOT there in the first place commented out like the php5 module...):
- LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
(as apache is compiled with dav_svn support and the dav_svn comes also preinstalled, I don't quite get, why this line was not in the standard httpd.conf. anyone?)
Now add the following line to your httpd.conf file, so that we can configure the svn locations in a dedicated config file: Include /private/etc/apache2/extra/dav_svn.conf
and create that file and create a svn location in it: Terminal:
sudo nano /private/etc/apache2/extra/dav_svn.conf
Contents of /private/etc/apache2/extra/dav_svn.conf:
<Location /svn/test> DAV svn SVNPath /var/svn/testRepository AuthType Basic AuthName "Subversion Repository" AuthUserFile /usr/share/pw/svn_pub.passwd require valid-user </Location>
now create a password file:
Terminal:
#create a password file for later use with svn: sudo mkdir -p /usr/share/pw/ sudo htpasswd -c /usr/share/pw/svn_pub.passwd admin # in order to add more users to that file leave out the -c switch (-> -c => create) sudo htpasswd /usr/share/pw/svn_pub.passwd newUser
now start (or restart) the apache server either in the terminal:
- sudo /usr/sbin/apache2ctl graceful
or by switchin OFF/ON the "SystemPreferences" -> "Sharing" -> "Personal Websharing"
For prior versions of MacOSX Martin Ott from codingmonkeys (SubEthaEdit) has created a package to install Subversion via doubleclick.
http://homepage.mac.com/martinott/
Note: there is also apackage for subversion 1.5.2
If you do not use the GUI tool svnx, but rather use svn directly from the commandline (or via the shell xtra, like I do myself) the steps to setup apache and test the svn CLI client are almost the same as described in the Linux section on this page.
Sources
- http://www.wikihow.com/Install-Subversion-on-Mac-OS-X
- http://developer.apple.com/tools/subversionxcode.html
- http://www.macdevcenter.com/pub/a/mac/2004/08/10/subversion.html
Client
- Client for Suversion: svnX -> http://www.lachoseinteractive.net/en/community/subversion/svnx/
Linux
Install and Configuration
Debian linux:
This assumes you already have the apache webserver up and running and the sudo tool installed, otherwise on debian it is just a matter of:
su root apt-get install sudo exit # install apache and php5: sudo apt-get -y install apache2 libapache2-mod-php5 php5-cli php5-common php5-cgi
Now let's install subversion and subversion apache
# start with updating your package sources list sudo apt-get update #install subversion: sudo apt-get install subversion libapache2-svn subversion-tools # now make a directory for you svn repositories sudo mkdir /var/svn #create a test repository: sudo svnadmin create /var/svn/testRepository # Test that the SVN repository works ##### make the directory writable by everybody, so svn can write new data to it sudo chmod -R 777 /var/svn/testRepository cd /tmp svn co file:///var/svn/testRepository cd testRepository svn mkdir tags branches trunk svn ci -m "Initial structure" # if at this point you get something like Adding branches Adding tags Adding trunk Committed revision 1.
Now let's add web server support:
#create a password file for later use with svn: sudo mkdir -p /usr/share/pw sudo htpasswd -c /usr/share/pw/svn_pub.passwd admin # in order to add more users to that file leave out the -c switch (-> -c => create) sudo htpasswd /usr/share/pw/svn_pub.passwd newUser #enable the svn module of your apache installation: a2enmod dav_svn ##### make the test directory owned by user www-data so that we can remove the write permission for everybody sudo chown -R www-data:www-data /var/svn/testRepository sudo chmod -R 755 /var/svn/testRepository
Now we add repositories to you webserver To do so edit the file dav_svn.conf, which is normally in your apache directory in /etc For normal apache2 installation on debian it will be at: /etc/apache2/mods-available/dav_svn.conf in case it isn't, just ysearch for it using the find tool
sudo find /etc -iname dav_svn.conf`
Once you located the file edit it with nano:
sudo nano /etc/apache2/mods-available/dav_svn.conf
for each repository you want to make available via your http server add something liek the following block to that file:
<Location /svn/test> DAV svn SVNPath /var/svn/testRepository AuthType Basic AuthName "Subversion Repository" AuthUserFile /usr/share/pw/svn_pub.passwd require valid-user </Location>
now restart apache: sudo /usr/sbin/apache2ctl graceful
and point your browser to the webserver: http://<your-domain>/svn/test
Client
The client is the svn tool, which we already installed. In the above svn test you already saw three commands of the svn tool:
- co => checkout
- mkdir => create directory
- ci => commit
as soon as you are in the local copy directory (the directory you checked out from the subversion server using the co or checkout command) you can omit the last parameter to the svn commands, as it then refers to the current working directory. Otherwise you can just add the path to the local working copy directory.
in order to view the available commands use:
svn help
in order to get help for a specific command use:
svn help <command>
the most common commands are:
- co (checkout) - Check out a working copy from a repository.
- up (update) - Bring changes from the repository into the working copy.
- ci (commit) - Send changes from your working copy to the repository.
- stat (status) - Print the status of working copy files and directories.
- add - Put files and directories under version control, scheduling them for addition to repository. They will be added in next commit.
- delete - delete (del, remove, rm): Remove files and directories from version control.
- export - Create an unversioned copy of a tree.
- diff - Display the differences between two revisions or paths.
- info - Display information about a local or remote item.
Sources
Debian linux:
Weblinks
- Subversion Web Site: http://subversion.tigris.org/
- Book: http://svnbook.red-bean.com/
- Clients: http://subversion.tigris.org/links.html#clients
- Cheat Sheet: http://www.abbeyworkshop.com/howto/misc/svn01/