What is Subversion?
Toshi Dávila avatar
Written by Toshi Dávila
Updated over a week ago

New to source control? Know you need to track your code better but not sure where to get started? Have no fear, we are here to explain to you what a Subversion repository is and why you may want to incorporate one into your development workflow.

Subversion (or SVN for short) is a version control system used to manage the files that make up a project as they are changed and modified throughout the life of the project.

Subversion is actively managed and maintained by the Apache Software Foundation.

SVN Repository

An SVN repository refers to the collection of files and directories and their accompanying version history. It is similar to a simple file directory in that it stores your important files, but goes a step further by also storing the history of each file in the repository.

Imagine a series of saved states (also known as revisions) that, when viewed in series, will show you the entire history (what changes were made, when they were made, who changed them, and why) of every file in your repository. As you might imagine, storing a full copy of every file in the repository at every revision would take an enormous amount of storage space. Instead, Subversion saves only the changes (together known as a changeset) between versions of each file. Subversion is then able to reconstruct any revision of any file in the repository using the changesets while using much less disk space than would otherwise be required.

Commits

When a changeset is committed, it essentially saves all of those changes to the centralized repository and creates a new revision.

Commit messages are used to explain the changes made and add context if those changes need to be viewed farther down the road by someone other than the author of those changes.

Basic SVN Workflow

Local Checkout

To begin, you must first check out a local copy of the repository. This will  download the most recent version of your files to your computer, where you can then make changes to and edit them.

Modifying Files

This step is easy! Simply edit the files using your favorite programs. Make sure to use your client’s UI (either a visual or command line interface) to commit those files back to the repository.

Reviewing Changes

Once you’ve committed your changeset to the repository, you need to review those changes to ensure everything is up to snuff. 

Reverting Changes

If a developer has made an error that needs to be rolled back, using the command “svn revert” will bring the affected file, directory, or even an entire repository back to the desired revision.

Conflict Resolution

Conflicts can happen when two members of a team make changes to the same file at the same time. 

If the file involved is a text file, chances are that those changes can be merged together and both sets of changes can be preserved. However, if the file is a binary file (usually visual assets), then any changes made to the file are unmergeable. In that case, one of the editors has just wasted a significant amount of time. He will now have to allow the other editor to upload their changes, check out the most recent version of the file, complete his own changes for a second time, and then commit the file back to the repository.

To sidestep this issue, SVN users can lock their files to signal to others that they are currently working on them. When they’ve finished their work and committed their changes to the repo, they can then unlock the file for other team members to edit. For more information on locking files, check out our article on SVN File Locking in Assembla.


Need help? Contact us at support@assembla.com. 

Did this answer your question?