Apache Subversion: Basic Workcycle
In Apache Subversion, the basic workcycle follows the ‘checkout-edit-update-commit’ format.
A ‘Checkout’ is the process of pulling all the files from your repository onto your local machine, where it becomes known as a ‘working copy.’ You can then work on these files in isolation, before sharing your work with the rest of the team by ‘committing’ back to the repository.
In this week’s tip, we’ll provide a handy introduction to this basic workcycle.
To checkout a working copy, run the ‘svn checkout’ command, followed by the URL of your repository and the location where you wish to create the working copy.
In this example, we’re creating a working copy on the desktop, in a file called ‘Repo’:
Tip, if you’re using the free uberSVN platform, you can easily find out your repository’s URL by opening the ‘Repositories’ tab.
You can now edit the files and folders in your working copy.
You may be ready to share your changes with the rest of your team, but it’s good practice to perform an SVN update first. This will pull any changes your colleagues may have already committed, into your working copy, ensuring your changes fit with the most up-to-date version of the project.
To perform an update, run the ‘svn update’ command, followed by the location of your working copy.
svn update (working copy location)
Let’s assume any changes your team committed are compatible with your changes, and go ahead with the commit. When performing a commit, you should leave a log message and include as much information as possible, as this can be an invaluable source of information if you ever need to revisit this revision. When performing a commit, the log message is entered in the “–m” format (for example, -m “added ReadMe file.”)
The commit itself is performed using the ‘svn commit’ command, followed the log message and the location of the working copy.
svn commit -m “log message” (working copy location)
In this example, we are performing a commit with the log message “added Admin Guide text.”
Need more Subversion know-how? After getting a great response from the Apache Subversion community in 2011, Subversion Live is back for 2012, bringing the Subversion community sessions covering everything from Subversion’s future, to expert-led best practices workshops, as well as the unique opportunity to meet the core Subversion committers. We’re currently running a very special early bird offer: register now using the ‘earlybird’ code to get a 25% discount (note, the early bird offer ends 10th August, so you better be quick!)