Introduction
Svk is a nice distributed control system on top of svn and provides a range of new possibility for version management. Though the documentation for svk is
sparse it is a really good tool and can be very useful.
Installation
svk is a perl module and is available through cpan. I assume that you are a svn user and have the svn client setup in your system.
If you already have the svn perl bindings installed, installation of svk will be as simple as typing the following command
$ perl -MCPAN -e 'install SVK'
Otherwise you may also need to install the svn perl bindings.
If you are using a debian based system, you may install the svk module using:
$ apt-get install svk
Command Examples
Using SVK
Example 1:
Problem: I want to branch from the trunk to implement a new feature and have all my updates on the svn sandbox. I also
want to periodically update the latest from the trunk to the sandbox. To leverage the true power of
svk I also want a local copy of the sandbox (Read the
user story posted by Eric Raymond in the Subersion mailing list)
Solution:
Say my new feature is cosmoacl, here is what I will do:
1. Mirror sandbox where I will have all my changes landed.
$ svk mirror svn+ssh://svn.osafoundation.org/svn/sandbox/vinu/cosmoacl //cosmoacl
$ svk sync //cosmoacl
The cosmoacl directory is empty and we will copy our source into this directory.
2. Mirror the trunk which I will never change.
$ svk mirror http://svn.osafoundation.org/server/cosmo/trunk/ //mirror/cosmo
$ svk sync //mirror/cosmo
3. I will copy the entire project from trunk to the sandbox:
$ svk smerge --baseless //mirror/cosmo //cosmoacl -m 'update to the latest cosmo r2558 and to see if the svk sync/smerge works'
4. To use the true power of svk, I will also create a local branch of the sandbox using
$ svk copy //cosmoacl //localacl -m 'local svk branch of cosmoacl'
I can use this local branch I am not connected to the network. I will first checkout the local branch using
$ svk co //localacl /home/user/cosmoaclsvk
So while working in a cafe, Bart or a no wifi region, I will do all my changes in /home/user/cosmoaclsvk. I will even do a commit, add, delete while working in this no wifi region.
Finally when I am back at my office or home, I will push all my changes using the push command.
$ cd /home/user/cosmoaclsvk
$ svk push
Wow, isn't that great! SVK will commit with all the log messages as if I was actually doing the commit at home/office.
Say there was some updates in the trunk, what if I want to sync the trunk changes to my sandbox or my local branch?
Here is what I will do for syncing to the latest revision
$ svk smerge //mirror/cosmo //cosmoacl -m 'update to the latest cosmo r2558 and to see if the svk sync/smerge works'
and then will pull or update the local svk branch using
$ cd /home/user/cosmoaclsvk
$ svk update
Commands to work with a new depot
| Result | SVK Command |
| Create a depot called newdepot at /home/vinu/.svkdepot | svk depotmap newdepot /home/vinu/.svkdepot |
| List all the depots | svk depotmap --list |
| Mirror a repository | svk mirror http://svn.osafoundation.org/project/trunk /newdepot/mirror/trunk |
| Listing the mirrors in the new depot | svk mirror --list /newdepot |
| Creating a local branch in the new depot | svk copy /newdepot/cosmocarddav /newdepot/localcarddav -m 'local svk branch of cosmocarddav' |
Links
--
VinubalajiGopal - 26 Sep 2006