wiki:SVK
Last modified 8 years ago Last modified on 06/28/06 14:39:34

Using SVK for OpenSync? is based on http://wiki.winehq.org/SVK.

What is SVK

SVK is a distributed RCS front-end to SVN. SVK is mostly like svn, except you mirror the repo on your hard disk and can do disconnected development.

Features

  • disconnected operation
  • ability to create local branches
  • easy merging,
  • and work with the existing svn repo.

svk does these things very well.

Why use SVK?

Using SVK, you can create your own branch from the main SVN repository.

This makes it easier to manage your own local changes in a source code control system, while keeping your copy up-to-date with the central repository.

You can also bring in changes made by other people and published to their own Subversion repositories.

Tools you will need

Workflow using SVK

1. Create the SVK depot

If you have never used SVK before, you will need to create the SVK depot:

mjahn@semo:~$ svk depotmap --init
Repository /home/mjahn/.svk/local does not exist, create? (y/n)y

2. Mirror a publicly readable OpenSync? Subversion tree into SVK

For example i use kdepim:

mjahn@semo:~$ svk mirror http://svn.opensync.org/plugins/kdepim //opensync-kdepim
Committed revision 1.
mjahn@semo:~$ svk sync //opensync-kdepim
Syncing http://svn.opensync.org/plugins/kdepim
Retrieving log information from 1 to 1070
Committed revision 2 from revision 398.
Committed revision 3 from revision 404.
Committed revision 4 from revision 414.
........
Committed revision 31 from revision 1035.
mjahn@semo:~$

opensync-kdepim is the local repository that you can freely choose.

Now you should create a branch for local editing.

If you wouldn't do that and just checkout the trunk to a working copy, SVK will sync every commit to the local repository to the remote one. (This would be a subversion mirror.)

3a. If you want to start with your own branch

3a.1. Create your personal Subversion repository

You should start with an empty Subversion repository.

Ideally you should create a personal Subversion repository that is accessible via a Subversion (svnserve) server, because that will make it possible for other people to merge changes from your branch. If you cannot do this, a local one will do, and it is possible to move a local one to a network location later if you use the fsfs file system of Subversion. If you cannot create a network accessible server, then use:

svnadmin create /usr/local/share/src/opensync-kdepim-branch

3a.2. Mirror the empty personal Subversion repository

mjahn@semo:~$ svk mirror file:///usr/local/share/src/opensync-kdepim-branch //me
Committed revision 32.

or, for example, for a network repository:

me@home:~$ svk mirror svn://svn.example.com/me/ //me

3a.3. Bring the current OpenSync?(Plugin) source into your new repository

You will probably only want to merge in the trunk rather than the trunk plus all branches. You will want to create two copies in your personal repository - one that tracks the OpenSync?(Plugin) source with no modifications, and one that tracks your personal copy of OpenSync?(Plugin) together with all the changes you use for yourself.

mjahn@semo:~$ svk mkdir -m "New directory for personal branch" //me/kdepim-sync
Merging back to mirror source file:///usr/local/share/src/opensync-kdepim-branch.
Merge back committed as revision 1.
Syncing file:///usr/local/share/src/opensync-kdepim-branch
Retrieving log information from 1 to 1
Committed revision 33 from revision 1.
mjahn@semo:~$ svk smerge -B -m "Copying the OpenSync pugin into personal repository" //opensync-kdepim //me/kdepim-sync
Auto-merging (0, 31) /opensync-kdepim to /me/kdepim-sync (base /:0).
Merging back to mirror source file:///usr/local/share/src/opensync-kdepim-branch.
A   tests
A   tests/check_note
A   tests/check_todo
A   tests/check_contact
.........
A   README
U  .
New merge ticket: 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e:/plugins/kdepim:1035
Merge back committed as revision 2.
Syncing file:///usr/local/share/src/opensync-kdepim-branch
Retrieving log information from 2 to 2
Committed revision 34 from revision 2.
mjahn@semo:~$ svk copy //me/kdepim-sync //me/trunk
Waiting for editor...
Merging back to mirror source file:///usr/local/share/src/opensync-kdepim-branch.
Merge back committed as revision 3.
Syncing file:///usr/local/share/src/opensync-kdepim-branch
Retrieving log information from 3 to 3
Committed revision 35 from revision 3.
mjahn@semo:~$

3b. If you already have a personal repository containing your own branch

Mirror your personal Subversion repository (presumably because you set up another machine and brought the main line in from there):

me@home:~$ svk mirror svn://svn.example.com/me/ //me
Committed revision 20686.
me@home:~$ svk sync //me
Retrieving log information from 1 to 2
Committed revision 20687 from revision 1.
Committed revision 20688 from revision 2.
me@home:~$

4. Create an SVK directory to hold published branches

This directory will contain predominantly branches from me/. The branches you store in this directory contain the changes that you submit back to opensync, and they are also what people will use to merge into their own copies on OpenSync?

mjahn@semo:~$ svk mkdir //me/branches
Waiting for editor...
Merging back to mirror source file:///usr/local/share/src/opensync-kdepim-branch.
Merge back committed as revision 4.
Syncing file:///usr/local/share/src/opensync-kdepim-branch
Retrieving log information from 4 to 4
Committed revision 36 from revision 4.
mjahn@semo:~$

5. Check out your private trunk

mjahn@semo:/usr/local/share/src/opensync$ svk checkout //me/trunk kdepim-sync
Syncing //me/trunk(/me/trunk) in /usr/local/share/src/opensync/kdepim-sync to 36.
A   kdepim-sync/tests
A   kdepim-sync/tests/check_note
A   kdepim-sync/tests/check_todo
.............
U  kdepim-sync
mjahn@semo:

Now you are able to work in this dir and merge your changes cleanly back to OpenSync?.

6. Sync with OpenSync? subversion

Say in the meanwhile the project evolved and I want to sync with it in order to get the latest features and code:

svk sync //opensync-kdepim

The local repository is now synced but my branch isn't. So I merge the changes to my branch. This can get dirty with Subversion after several merges as you have to explicitly name the revision since you last merged from the trunk.

With SVK and it's star-merge this is easy:

svk smerge //opensync-kdepim //me/trunk 

The only thing left to do is merging the branch with the working copy through a svk up if you have one. Otherwise were officially synced!

To sync the repositories in the other way round, that means to commit your local changes to the remote server, just change the repositories-arguments to svk smerge.

So we merge our branch with our local trunk:

svk smerge //project/local //project/trunk 

and we're done as SVK syncs the local repository automatically with the remote one (in both ways).

(EDIT: We have read only access to opensync svn so the changes will not commited ... but you can make a patch for upload.)


This Page derived from: