Jens Krämer

Work offline with SVK and Subversion

 |  scm, linux

SVK comes in handy whenever you want to work on a project whose files are kept in a remote Subversion repository, but you don’t have network access.

Sure you could just hack away and commit once you’re online again, but this way you lose all the things you are using a version control system for: commit/rollback, changesets with meaningful descriptions, branches and so on.

Besides that, another huge plus of svk is the complete lack of any metadata inside working copies - no more .svn directories getting in your way!

Once you have SVK up and running on your system (see the SVK book and Installing SVK for help), you first mirror your Subversion project in your SVK depot (I’ll use the acts_as_ferret SVN project as an example):

svk mirror svn://projects.jkraemer.net/acts_as_ferret //acts_as_ferret/trunk

svk sync //acts_as_ferret/trunk will now pull the existing revisions from Subversion into your SVK repository.

Now checkout your svk project:

mkdir acts_as_ferret
cd acts_as_ferret
svk checkout //acts_as_ferret/trunk

As this trunk directory is a mirror, any commit done here will be propagated to the remote SVN server immediately. Not exactly what we want, yet. We need to create a branch for our offline work:

svk copy //acts_as_ferret/trunk //acts_as_ferret/local
svk checkout //acts_as_ferret/local

This local directory is where you do all your offline work. As the branch only exists in SVK, any commits done here will stay local to your machine.

Working with SVK is easy if you already know SVN, commit, update, checkout and diff all behave as expected.

To synchronize your work with the remote repository when online again, use the following commands:

To sync and pull all your projects at once you can use svk sync -a and svk pull -a.

Comments

You can use Markdown here.

For the sake of spam checking any data you submit, including your IP address, will be transferred to the US based Akismet web service (akismet.com). If that's not acceptable for you, you can also reach me by other means.