Many readers may have heard of the phrase “SVN repository”, but may be unsure exactly what it is. Maybe you have a bit of an idea, but don’t know where or why you would need to use one. This post explains in straightforward terms what is a SVN repository, and gives you a basic understanding of how it works and when and why you should use one.
SVN is a shorthand abbreviation of the name “Subversion”. For those who have not heard of it, Subversion is a powerful open-source version control system that is typically used to manage the collections of files that make up software projects. However, a SVN repository it may actually be used for managing any collection of files that are changed or modified over time.
Subversion was initially developed by CollabNet as an alternative to the earlier CVS version control system, which suffered a number of limitations, such as being unable to move or rename files. These days Subversion is actively developed and maintained by the Apache Software Foundation and you can download SVN for most platforms for free.
The SVN moniker itself actually comes from the name of the command that is typed when accessing SVN repositories via the command-line of a computer, hence it is common practice to use the terms ‘svn’ and ‘subversion’ interchangeably.
In simple terms, a SVN repository (or Subversion repository) is a collection of files and directories, bundled together in a special database that also records a complete history of all the changes that have ever been made to these files.
Conceptually, a SVN repository is similar to a folder or directory on your computer that may contain a collection of assorted, but related, files and directories. In fact, a SVN repository is typically used to store all the files and directories that make up a single project, or perhaps even a collection of interrelated projects.
However unlike a normal folder on your computer that stores only the most recent copy of a collection of files, a SVN repository also stores the history of those files.
One way to think of a SVN repository is by imagining a series of snapshots, called revisions, that record copies of all the files and directories that make up a project at specific points in time. However instead of storing full copies of each revision of every file (which would very quickly require a huge amount of disk space!), a SVN repository only records the changes or differences between files at each revision. These differences are known as a changeset.
A SVN changeset consists of a description of all the additions, modifications and deletions to files within the project required to go from one revision to the next, along with a human-friendly text description that reports the nature of the changes. The collection of all changesets in a project is what makes up a SVN repository.
By drawing on this database of changesets, the Subversion tools are able to recreate exactly any revision of any file in the SVN repository, at any point in time. Not only that, it can do so by using far less disk space than would be required if full copies of each of the file revisions were stored instead!
By storing a complete history of every change ever made within a project, it is possible to use a SVN repository to do many things that would be difficult or impossible to do with only copies of the project files alone.
To get started using Subversion, you first need to have a SVN server to host the repository. There are several ways to do this, depending on your technical knowhow and the benefits you wish to achieve by using it. For example, you can:
Whatever solution you choose, once you start using Subversion the power of a SVN repository becomes apparent very quickly. Over time you will discover more and more ways that you can benefit from version control, and eventually you will begin to wonder how you lived without it!
What uses have you found for your SVN repository?