create new tag
, view all tags

Branch development with SVK

2008-03-11 - 20:30:33 by GilmarSantosJr in Development
Sometime ago I started TWikiStandAlone project and one of the first problems I faced was "which code base should I use?"

Since I would create a branch, I thought about to use 4.1.2, the last stable release at that time, but this approach had some problems:

  • Some changes I needed was already performed at MAIN branch, but not at 4.1.2
  • When finished, it would be difficult to merge with MAIN

On the other hand, if I had created a branch from MAIN, how could I keep it in sync? How could I merge fixes and updates from MAIN to the branch? SVN is cool, but it's not good to look for each revision I'd like to merge. I had a fast conversation about it with SvenDowideit and we agreed that git was a good tool for this kind of situation. However it was not so good cause it doesn't integrate well with svn. Finally AntonioTerceiro presented me SVK. It was exactly what I was looking for! With simple commands I could develop within the branch, commit to TWikiSVN and merge changes from MAIN. Follows the HowTo:

First step is to create a mirror and sync. In the setup step it takes a lot of time (it was about 20 hours with my not-so-cool connection). Currently (rev 16511) it uses 603 MiB.

$ svk mirror http://svn.twiki.org/svn/twiki //mirrors/twiki.org
$ svk sync //mirrors/twiki.org

I mirrored everything cause I needed both scratch and MAIN. After setup, its use is very similar to svn:

$ svk co //mirrors/twiki.org/scratch/TWikiStandAlone # Checkout a work copy
$ cd TWikiStandAlone
# (...) make changes...
$ svk ci # Commit changes. Since its a mirrored path, than svk commits back to TWikiSVN

So time passes and:

$ svk sync //mirrors/twiki.org
$ svk up # We are at TWikiStandAlone checkout. This command get any changes made to the branch at TWikiSVN
$ svk smerge //mirrors/twiki.org/branches/MAIN . # And finally the magic! It merges to local copy every change to MAIN branch!
# (make more changes...)
$ svk ci # And then commit back to TWikiStandAlone branch, with updates and fixes made to MAIN!

Note that svk figures out which is the base and what are the revisions to do the merge.

I have to say that svk was essential after the redesign of TWikiSVN. All I needed to do was:

# Reflect what was made to MAIN in TWikiStandAlone
$ svn mv http://svn.twiki.org/svn/twiki/scratch/TWikiStandAlone/twikiplugins \
$ svn mv http://svn.twiki.org/svn/twiki/scratch/TWikiStandAlone \
$ svn mv http://svn.twiki.org/svn/twiki/scratch/TSA \
# Sync local mirror
$ svk sync //mirrors/twiki.org
# Update checkout
$ svk up
# And magically merge changes!!!
$ svk smerge //mirrors/twiki.org/trunk . # We're still at TWikiStandAlone work copy. This gave me some conflicts, but worked.

It's important to state that it was possible cause I mirrored the hole repository. Otherwise svk would not be able to find merge base.

The result is that TWikiStandAlone branch is very close to trunk and merge will be fairly easy smile (although I will not use svk to do the merge, cause it will be good to merge incrementally: one commit for each logical change).

SubversionMirrorSetUp illustrate a different way to use svk. Particularly I prefer the way I described, since I don't need a local svn (why would I use svn for my personal projects if I can use svk?). I strongly recommend the svk visual guide for more info.

So, happy branch development! smile



Topic revision: r1 - 2008-03-11 - GilmarSantosJr

Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Help
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.