In our last installment, we created a set-up allowing you to keep all the various revisions to your documents, without the need to resort to tricks like appending file names with version numbers. So now you have this repository of documents, how do you take advantage of it? In this article we’ll show you how to recall a previous version of a document (we’re all familiar with thinking putting something brilliant in a document, only to have it overwritten), as well as how to download all your in-process work to another machine.
Step 1: Viewing and Accessing Your Document’s Revision History
Undoubtedly, at some point, you’ll want to go back to a previous version of a document, either to retrieve something you deleted within (it seemed like a good idea at the time!), or to track the progress of the document over it’s different versions. Subversion makes it easy to see the history of document, although it’s hidden behind some “developer-speak.”
Viewing the history of an item is as simple as right-clicking on it in kdesvn and selecting the “History of item” option. This will display a new window showing all the past revisions of the document (i.e. the version each time you “committed” it). To view one of these past versions in kdesvn, click on it in the left-hand pane (you can use the dates and/or version numbers to help you decide which is the right one). In the lower-right pane, the document’s path and file name appear – right-click on the filename and select the “Cat this version.” Not the most intuitive name for the non-technical user, true, but it does the trick.
Your document will be launched in the default application. Notice the filename in Writer’s title bar in the screenshot (“kdesvnZ16946.tmp”)… so if you make any changes to it, you’ll need to save them as a different file. After that, you can upload that into the repository, capturing your old content and any new revisions you’ve made.
Step 2: Accessing Your Repository From Another Machine
So you’ve been working on some files on your desktop, capturing all manner of brilliant ideas, but now you need to get out. Maybe you need to share all this brilliance with the world. Maybe you just need a coffee. In either case, how do you take all this work on your with you on your laptop or netbook?
The first step is to make sure all your content is up-to-date. Check kdesvn to make sure there are no red-highlighted files.
Tip: you can use the “Subversion > Working Copy > Check for Updates” feature to make sure your view of files is refreshed. Bonus Tip: Add this to your toolbar using the “Settings > Configure Toolbars…” dialog.// Next, we’ll need to add some software to your desktop machine.
If you’re a newer Linux user, and you haven’t discovered the joys of SSH, you’re in for a treat. SSH is a way to remotely access a Linux machine securely, and also do some pretty neat tricks. To install what we need, select OpenSSH-Server and Subversion from your favorite package manager, or you can enter the following command in a terminal:
Once these are installed on the desktop, make sure that the SSH server is running. You can do this by checking a graphical process manager (such as KDE’s System Monitor) and confirming the program sshd is running.
Once you’ve done this, accessing a repository is simple. Firstly, make sure a Subversion client is installed on your laptop. You’ll need to do a “Check out current repository path,” just as you did in the first article, with one key difference. In order to access your repository remotely, click the “Open” button on the toolbar. Then, enter the following in the dialog:
Replace the “remote-IP-address” and the “path-to-the-repository” with the appropriate value.
The “svn+ssh://” part of the URL indicates that you’re accessing a Subversion over a SSH network. Wait for the checkout to finish, and presto!, you’ve got a copy of your repository on your laptop, ready to follow you wherever you go. Once you’ve made changes on-the-go, just connect to your home network, open up your local copy, look for the red highlights, and commit. Once you commit and get back to your other machine (in this case, the desktop), opening kdesvn will show you have newly-updated files to collect. “Updating” is the term in Subversion-speak, and updating to the most recent is often called “update to HEAD” (“HEAD” here refers to the “head” of the Subversion branch, which is to say the furthest-most out, time wise, i.e. the most recent). Selecting the “update to HEAD” option for a file or folder will download the most recent versions to your machine.
By using Subversion, you can check out files on one device, then upload the changes to be pushed out to any number of other devices or machines. And if you heeded the tip in the first part of this article, and keep all of your documents under a single parent folder, the process to “commit” all the changes you made while on the go is just a couple clicks. Not as automatic as Dropbox, maybe, but Subversion gives you more control, and allows you to keep versions of all the changes you commit.
Our latest tutorials delivered straight to your inbox