Creating SVN Mirror Repository Using SVK
This is an alternative to "vendor branch" method for source code management. I have used it for last 3 months and takes about 30 seconds to merge all ofbiz updates except when you get conflicts. This description does not include trunk/branches for simplicity.
- Install SVK.
- Create a local SVN (NOT SVK) repository in your system using regular svn command. Under Unix/Linux, you must be logged in as the user of the repository. You can not change owner/group/permission of the repository and have things work correctly. If you need to change any of that, you are better off deleting the repository and recreating it. I also found that I had to make apache (the user of the httpd) the the owner of the repository on my server to make it work correctly over the http.
- Tell SVK about this repository. SVK calls it depot. An editor will pop-up (which can be changed using $EDITOR environment variable). Edit it to point to your repository and save.
- Create a mirror of http://svn.ofbiz.org/svn/ofbiz/trunk in your local PC/LAN. We will call it uplink.
Code Block |
---|
svk mirror http://svn.ofbiz.org/svn/ofbiz/trunk //uplink
svk sync --skipto HEAD //uplink |
This will mirror the current HEAD rather than the entire history, and shouldn't take much longer than a regular SVN checkout. - Create a working repository for SVN users (it uses the same copy command)
Code Block |
---|
svk copy //uplink //local |
//local is now the SVN local repository.
Usage
- Checkout using SVN (not SVK) from file:///<repository location>/local
- Make changes as usual
- Use regular svn client commands (e.g. commit, update) for code management which now talk to //local repository
- To download updates from OFBiz
Code Block |
---|
svk sync //uplink |
- To bring in changes from OFBiz repository but not send changes back
Code Block |
---|
svk pull //local |
- To bring in changes as well as send changes up
Code Block |
---|
svk smerge //uplink //local |
- To update working copies, use svn update command.
- To create a patch of all changes in local repository compared to ofbiz/trunk and store in patchfilename.patch
Code Block |
---|
svk push -P patchfilename //local |
- To apply a patch (say bug1.patch) to the repository, place the patch in .svk/patch directory and run
Code Block |
---|
svk patch --apply bug1 //local |
Thanks to Vinay Agarwal for this tip