Penned 15 years ago. It will take about 6:0 to read.
So you want to get Subversion running on your mac, complete with nifty finder integration? Good, welcome to the wonderful world of revision control.
This little ditty will assume that you have an SVN repository to connect to already, and all you need is the client-side tools. If this is not the case, then move on.
That is a valid question, and one that I get pretty often when I am talking about CVS, SVN or Arch. In short revision control breaks down like this:
Go that? Excellent, moving on.
So now that we have established what version control is, how do we use it? For basic operation there are only a few command we really need to know:
There are a number of other commands, such as mkdir (create a new directory) and blame (assign blame to someone for a screwup... one of my favorites.) but those outlined above are the most used.
The easiest way to install SVN is by browsing to the binary downloads page and scrolling down until you find MacOS X. You will want the second link, the one that does not rely on Fink. Grab the 1.2.1 (or whatever is the newest) binary from the Metissian page and install it.
After the installer has run its course you now have a running SVN client on your mac. Next we have to decide how we are going to access that SVN client.
There are two ways to use SVN on your MacOS X box, either through the terminal or through a third party GUI based solution. I will not cover the terminal in depth since for most of us a Finder integrated solution is superior. But for the sake of completeness here are a few brief notes.
First of course we need to launch the Terminal application located at
/Applications/Utilities/Termimal.app. Once the terminal is running, we need to choose a location for our files downloaded from the remote server.
Let's say we are going to use
/Users/yourname/checkouts/. First we need to navigate to
Users/yourname/ and create the
MyMac:~ yourname$ cd /Users/yourname/
MyMac:~ yourname$ mkdir checkouts
You should now be able to navigate to your users folder via the Finder and see the newly created
checkouts folder. Now we hop back to the terminal and move into that directory and call SVN for the first time:
MyMac:~ yourname$ cd /checkouts/
MyMac:~ yourname$ svn co svn.theremoteserver.com/wooga
Congratulations, you have just performed your first SVN command. Anytime you interface with SVN via the terminal you begin with
svn, then you tell svn what you want to do, in this case we said
co and we know from earlier that this means Check Out. So if all went well you should now have a folder inside of
wooga and inside this folder we have our files, ready and waiting for editing.
You can now edit those files with any app you wish. Once you have saved your changes locally all you need to do is go back to the Terminal and navigate to
/Users/username/checkouts/wooga and enter:
MyMac:~ yourname$ svn diff
MyMac:~ yourname$ svn commit
Running diff is not required, but it is a good idea to make sure that you are aware of all the files you have changed. The Terminal window should show you SVN adding (A), updating (U) or deleting (D) files, based on what changes you have made locally.
And that is it for the Terminal. More information can be found at Subversion Forum.
This is, for most of us, the most natural method of interacting with SVN on our Macs. By downloading and installing scplugin from tigris, we can fully integrate SVN into the Finder.
After downloading and installing the plugin, there will now be a new contextual menu when you right-click/control-click in the Finder labeled Subversion. If you open that submenu you will see all the commands you have at your disposal.
To replicate our steps above via the Finder we would simply:
And that is all there is to Checking out via scplugin and the Finder. Next you would open and edit files, and then go back to the Finder to run Diff and Commit which are both found via the Subversion contextual menu.
That is it really. If you install scplugin you will notice that files that you are interacting with will have green checkmarks on them, or blue pluses, or red exclamation points. This is normal. The green checkmark means that you local copy is in sync with the remote copy; the blue plus means the file has been added and is ready for Commit and the red exclamation point means that the local copy and the remote copy are out of sync, most likely due to changes you have made locally.