Get Started with Subversion using SvnX

A very important part of a development environment is source code control. Subversion is the server-side software that I use for this. There are a number of SVN clients for the Mac. Let’s take a closer look at setting up my favorite SVN client for the Mac – SvnX.

SvnX is a free and open source SVN client for the Mac. It has a rather simple user interface and supports most features required for SVN work. Let’s install it to get a better idea of what it can do. Head over to the SvnX site and download the latest release. After your download completes it should extract automatically. Drag and drop the SvnX application into your system’s Applications folder. That’s it, the installation of SvnX is complete. SvnX is a front-end for the SVN client, and therefore we need to also install the SVN client binary for SvnX to work.

Download the SVN client binary from here. Extract the file you download and copy the svn binary file to /usr/local/bin/

Double click on SvnX in your Applications folder to launch it. The first screen will look something like in the image below. There are two windows here, titled Working Copies and Repositories. You’ll get a better idea of what these two are as we go along.

Before we get into the details of configuring SvnX here’s a quick explanation of how SVN works. There is a repository hosted on a central server which keeps a copy of the documents for project. This could be code or other kinds of documents. The repository maintains versions of the documents. Every time you “check in” new versions it adds a “tag” for the new version so that you can retrieve an older version of the document at any time. Here’s a very good introduction to how SVN works.

To configure SvnX click on SvnX in the application’s menu and then choose Preferences. In the Preferences window enter the path of the svn binary, which is /usr/local/bin/ in our case.

Now let’s configure SvnX to work with your repository. For the purpose of this exercise I will use a repository that is hosted at the following address – “http://svn.sevenacross.com/project”. The username and password for this repository are “calvin” and “calvin123″ respectively. Please replace these with the information for your repository.

In the window with the title Repositories add the address of your repository, the username, and the password:

After you’ve entered all this information double click on the the entry for this repository to launch it. you should get a window that looks like the following:

It would contain a set of directory in the navigation area at the bottom. Select the directory you want to “check out” and click on the button svn checkout at the top of the window. A finder window should pop up asking where you want to “check out” the documents. After the process of “checking out” the code is over you will find an entry for it in theWorking Copies window.

You are ready to begin working with these documents. Now open finder and go to the directory where you “checked out” the code. Edit one or two documents by adding a line of text or a few words somewhere and then save the files. Return to SvnX and double click on the entry for the project in the “Working Copies” window. You will find the files you modified listed in the window that opens. Select them and click on the Add button. Now enter these modified files back into SVN by clicking on the Commit button. Now if someone else were to “check out” this project out of your SVN server she will see the new files with a new tag.

Suppose there are many people working on this project you need to make sure you have the latest version of the documents before you start working on it again. To do that double click on the project entry in the “Working Copies” window and click on the Update button. This will fetch all the latest revisions for all the files that are part of this SVN repository.

There are many things that you can do using SvnX such as moving a section of the repository, or finding the differences between multiple files… but they are beyond the scope of this article. Feel free to read up the project’s documentation or to play with SvnX to discover how to perform these tasks.

posted @ 2015-01-15 09:37  如来藏  阅读(455)  评论(0编辑  收藏  举报