Setting Up Subversion for Development on Windows
By Akash Mehta2008-07-02
Introducing Subversion
When developing web applications on your own, a common
challenge is keeping track of your changes. Mature version control
systems make it easier to manage development as projects increase in
size and complexity. In this tutorial, I'll show you how to set up
Subversion on a Windows machine and get started with a simple project.
Subversion, or SVN, is a stable version control system designed for maintaining versions over files. As a very mature project, having started in 2000, Subversion is the generally accepted standard for managing versions of files in software projects. A number of plugins and interfaces are available for Subversion; for example, the Eclipse IDE has near-seamless integration with Subversion through the Subclipse plugin. While a number of newer version control systems, known as distributed version control systems, are better suited for managing a team of distributed developers, Subversion remains the standard for ease of installation and use in single developer environments.
Why use a version control system?
When developing software individually, development processes are often very experimental. For example, one might put together some mock-ups of a feature to explore if it can be implemented. Problems arise when changes cause existing code to break, and it is often easier to start over with the "last good" version - but how do we keep track of these versions? This brings us to the core role of version control in single user environments: maintaining copies of files and the changes made to them, usually in such a way that they can easily be restored as the need arises. A version control system can monitor changes to a file over time, and quickly reset all copies of a file back to an earlier state.
There are a number of additional benefits to version control systems such as Subversion. For example, projects can be "forked" or "branched" on demand - that is, major changes can be made in a copy of the project code independent of the main working copy (the "trunk") and merged back later. Complex projects can benefit considerably from this feature, allowing developers to make non-destructive changes to their codebase knowing that they can easily revert to a stable version or merge changes almost seamlessly.
Subversion 101
Subversion works around repositories, or complex data stores holding all the versioning information about a codebase. Repositories are simply file structures on disk, and can be interfaced through an SVN server. SVN servers provide a layer on top of these repositories, serving to both expose the repository to the world - e.g. over a network - and to maintain access controls over the repository. Once we have an account with the server that has access to a particular repository, we can then get started with versioning our software project.
We start by importing the existing codebase into the repostiory, from the latest "HEAD" revision. As we make changes, we commit them to the repository. For each of the files that has changed, a new version is stored in the repository, and a new revision
is created. A local data store with some meta data about the repository
(and spare copies of files) is updated. These data stores are found in
hidden .svn directories, which you may notice around your
filesystem. Subversion doesn't usually touch your local copies of files
when making commits, it simply records some information in the .svn directories.
For more information on Subversion, have a look through the book Version Control with Subversion, available free online thanks to O'Reilly.
Tutorial Pages:
» Introducing Subversion
» Setting up a Subversion server on Windows
» Working with Subversion
» Further reading
