How SVK has made my life happy

April 04, 2008 at 03:40 PM | Work | View Comments

SVK, despite some of it's shortcomings, has proved worthy of my use in the last couple of days. Here is a quick script which shows how I've been using it, and how it's rocked the pants off of SVN:

red = commands with SVN
blue = equivalent SVK commands
green = comment

# Mirror the DrP repository to //dpr
$ # No equivilent
$ svk mirror //drp/

# Create the tags branch
$ svn cp \
$ svk cp //drp/trunk //drp/branches/tags

# Check out the branch
$ svn co Tags
$ svk co //drp/branches/tags Tags

# Some changes are made to the tags branch

# Checkin those changes
$ svn ci -m "Made some changes to tags branch"
$ svk ci -m "Made some changes to tags branch"
# In this case, SVK is not being used in decentralized
# mode, so the changes will be pushed upstream to the
# SVN repository, just like the svn commit does.

# Changes have also been made to trunk.
# Time to merge those changes in.

# First, a merge with SVN:
$ svn log --stop-on-copy
# Look for either the last revision which trunk was merged
# You can't always use the base revision, otherwise conflicts
# may ensue.
$ svn merge -r $REV:HEAD .
# Hope that there are no trivial conflicts to sort out,
# then test and commit the merge. 
$ svn ci -m "Merged trunk into tags."

# And now, exactly the same operation with SVK:
$ svk pull
# ... changes are merged ...

I don't think I need to say any more :-)

(Yes, I realize that there are tools like which make SVN merges less painful... But that's one extra command to run. And you've still got those stinking .svn directories everywhere.)

[edit] Fixed up the coloring so it may work a little bit better, and my stylesheet doesn't destroy the layout of the comments section. [/edit]