Personal tools
You are here: Home HowTos Howto svk

Howto svk

How to maintain multiple repositories with the same sources synchronized. Keywords: distributed & decentralized development

 Sometimes we have our institution sources repository that means a working or development repository, and sometime sync to the sourceforge sources. This howto tries to made easy this step.

Introduction

 The idea about synchronization is to maintain the log data between all the repositories, the one who is the primary for your development and all the others where you like to maintain mirroring. Mirror your code is an usage to publish your code. But can be other reasons.

 Personally, I'm using some devices from Soleil with I'm also contributing with little peaces of code. I like to have my modifications until the approval of the main developer. Then I need to have my control version repository, but If another feature is implemented and committed to sourceforge I like to have it. It mean synchronize my repository to the tango community one.


What is svk?

Svk is able to do many more things that I propose to use. This software is a decentralized control version system, it doesn't mean distributed like git, bazaar or mercurial. A good point of svk is this software is able to use many other repositories as low level repository: a file, an svn, a cvs; and made transparent for you usage what is lower.

Usage of svk


Prepare

First of all, what is need is a project to be shared. Create it from scratch or checkout what you already have on your institution repository. I call internal.org/svn the repository in-house. As a sample that it is, I add a directory with a sample data: it's a file called log:
serguei@pio:~/svn/alba/miscellaneous$ svn add svk.test
A         svk.test
A         svk.test/log
serguei@pio:~/svn/alba/miscellaneous$ svn ci
Adding svk.test
Adding svk.test/log
Transmitting file data .
Committed revision 5224.
After pass throw the test and other things I want from this software I like to publish it to sourceforge to share what I wrote to the tango community. Remeber to add the GPL headers.
Ok, lets go to commit what we have internally to the public repository in sourceforge. Then can be useful to have what we can call the project there, meaning void thing:
serguei@pio:~/svn/sf/tango-ds.svn$ svn add svk.test
A         svk.test
serguei@pio:~/svn/sf/tango-ds.svn$ svn ci
Adding svk.test
Transmitting file data .
Committed revision 18.

Now what we have is a repository in-house and a void directory share. We have to thing to easily maintain synchronization. If there are tools to do it, why lose time doing it by hand (and by hand there are many errors waiting to visit you).

Create your mirroring

serguei@pio:~$ svk mirror svn+ssh://internal.org/svn/trunk/miscellaneous/svk.test //internal
serguei@pio:~$ svk mirror https://tango-ds.svn.sourceforge.net/svnroot/tango-ds/svk.test //external
serguei@pio:~$ svk sync --all
serguei@pio:~$ svk smerge --baseless --incremental //internal //external

It synchronize the //external with what is in the //internal. Check it, update what it is on sourceforge:

serguei@pio:~/svn/sf/tango-ds.svn$ svn up
A svk.test/log
U svk.test
Updated to revision 21.

Push local changes

serguei@pio:~/svn/alba/miscellaneous/svk.test$ vi log
serguei@pio:~/svn/alba/miscellaneous/svk.test$ svn ci
serguei@pio:~/svn/alba/miscellaneous/svk.test$ svk sync --all
serguei@pio:~/svn/alba/miscellaneous/svk.test$ svk smerge --baseless --incremental //internal //external

serguei@pio:~/svn/sf/tango-ds.svn$ svn up
U svk.test/log
U svk.test
Updated to revision 22

Pull remote shares

serguei@pio:~/svn/sf/tango-ds.svn/svk.test$ vi log
serguei@pio:~/svn/sf/tango-ds.svn/svk.test$ svn ci
Sending svk.test/log
Transmitting file data .
Committed revision 23.
serguei@pio:~/svn/sf/tango-ds.svn/svk.test$ svk smerge --baseless --incremental //external //internal

serguei@pio:~/svn/alba/miscellaneous/svk.test$ svn up
U log
U .
Updated to revision 5227.

Logger

It's important to know who and what says in the logs, the main problem of manual sync is you are losing every thing you wrote in the internal repository:
serguei@pio:~/svn/alba/miscellaneous/svk.test$ svn log -r5227
------------------------------------------------------------------------
r5227 | sblanch | 2008-11-21 16:39:45 +0100 (Fri, 21 Nov 2008) | 5 lines
 r12@pio (orig r23):  sergiblanch | 2008-11-21 16:38:05 +0100
 commiting a change on the external
After the synchronization in the external we are able to read what was written:
serguei@pio:~/svn/sf/tango-ds.svn/svk.test$ svn log
------------------------------------------------------------------------
r22 | sergiblanch | 2008-11-21 16:36:04 +0100 (Fri, 21 Nov 2008) | 4 lines

r10@pio (orig r5226): sblanch | 2008-11-21 16:34:44 +0100
commiting a local change


------------------------------------------------------------------------
r21 | sergiblanch | 2008-11-21 16:30:30 +0100 (Fri, 21 Nov 2008) | 4 lines

r5@pio (orig r5224): sblanch | 2008-11-21 15:56:03 +0100
this is the comment for the internal commit


------------------------------------------------------------------------
r20 | sergiblanch | 2008-11-21 16:30:17 +0100 (Fri, 21 Nov 2008) | 4 lines

r4@pio (orig r5222): sblanch | 2008-11-21 15:17:23 +0100
modification in alba


------------------------------------------------------------------------
r19 | sergiblanch | 2008-11-21 16:29:58 +0100 (Fri, 21 Nov 2008) | 4 lines

r3@pio (orig r5220): sblanch | 2008-11-21 12:44:58 +0100
testing svk


------------------------------------------------------------------------
r18 | sergiblanch | 2008-11-21 16:28:25 +0100 (Fri, 21 Nov 2008) | 2 lines

create the directory for the svk test

------------------------------------------------------------------------

Document Actions

Doing a sync

Posted by Sergi Blanch i Torné at Dec 29, 2008 03:10 PM

Having two repositories with the same sources who has uncentralized development, I made a sync:

$ svk mirror svn://cvs.gnupg.org/libgcrypt/trunk //libgcrypt_gnupg

$ svk mirror https://tools.laigu.net/repos/eccGnuPG/src/libgcrypt/ //libgcrypt_toubkal

$ svk sync --all

In the toubkal mirror it is the revision 73 where I have the sources from the 1356 revision of the GnuPG repository.

$ svk smerge --baseless --incremental //libgcrypt_gnupg //libgcrypt_toubkal

After this command, in the toubkal repository the last revision is numbered 91 and it contains the modifications I had and the modifications made on GnuPG repository until the revision 1375, the last now a days. For each commit on GnuPG's repos, the toubkal has algo one. Without the incremental option would have been in only one commit in toubkal (with a concatenated big comment).

Many conflicts has been found during this merge, and they have had solved by hand.