GOAL: An alternative quick start guide to set up a simple strategy that allows you to maintain a customized version of OFBiz under SVN revision control synchronized with the standard OFBiz SVN.
This document is different to the SVN Tips in that it does not use the "svn_load_dirs" script but it relies on two very good tools Tortoise SVN and WinMerge. Some might say that unfortunately these tools are somewhat tainted by their platform requirements but I could not get the "svn_load_dirs" script to work for me (I tried and tried on several platforms) so I picked two tools that I can rely on and would recommend to any MS platform user.
1. SVN Repository
Create a new SVN repository....
Initialization of an empty repository
- Edit the ./svn-repos/conf/svnserve.conf file
- Edit the ./svn-repos/conf/passwd file
Start the service
Using explorer right mouse and SVN Checkout and enter:
http://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk - as URL of the repository
Checkout directory: C:\Work\OFBizApache\ofbiz_apache_current
You can take the head or enter a revision if you want to start at a specific point.
Right mouse on ofbiz_apache_current and select SVN -> Export
create a new folder as C:\Work\OFBizApache\ofbiz_apache_rXXXXXX_export and start the export
XXXXXX equals the revision number which for this example will be 482800.
Right mouse on ofbiz_apache_r482800_export\ofbiz_apache_current and select SVN -> Import
Browse to your server repository and the using right mouse create a structure something like:
then select current and OK the dialog.
URL - svn://localsvn.mydomain.com/ofbiz/current
Import message - ">>>>>>>>>> Imported from clean Apache OFBiz SVN r482800"
You may think the prefix on the import message is silly but we find it very useful as time goes by because we operate more than one project from the same repository when viewing the repository history it's very easy to see changes related to specific projects. And further below you will see all changes are prefixed with a simple project code.
Now checkout the new local OFBiz, right mouse in your working directory and select SVN Checkout
URL - svn://localsvn.mydomain.com/ofbiz/current
directory - ofbiz_local_current
Now we branch the current so we can setup our custom version.
Right mouse on the ofbiz_local_current and select SVN -> Branch
In the dialog I'm going to create my branch in svn://localsvn.mydomain.com/custom/customofbiz using the Head revision and a comment like "CO ---- Merged OFBiz "current" r4828000 (Apache SVN) into new the CustomOfbiz project"
This creates it under custom/customofbiz/current which is not the standard so I rename "current" to "trunk", done using SVN -> Repo Browser, select the entry and press F2.
Now we can checkout a new local custom project ready for modifications. Right mouse in your working directory and select SVN Checkout
URL - svn://localsvn.mydomain.com/custom/customofbiz/trunk
directory - customofbiz_local_current
Now you do your work and modifications on your local custom project and commit changes as you please.
When the time comes, maybe monthly but it's your choice, you can update your local repository version of OFBiz from the live Apache SVN version.
Make sure you have a clean unmodified and up to date revision of both SVN projects, ofbiz_apache_current and ofbiz_local_current.
Export the current live OFBiz as per stage 3 above, updating the revision number as appropriate, so in this example I end up with ofbiz_apache_r483333_export\ofbiz_apache_current.
3. OFBiz Merge
Now I'm going to merge the exported folder into ofbiz_local_current using WinMerge. I tend to merge left to right so do:
Filter: [F] Java CVS/SVN loose (just want it to skip the .svn folders)
How to merge: (helps to hide skipped and identical files)
1) Sort by Comparison results
2) Transfer all files listed as "Files are different" and "Binary files are different", left to right.
3) Now sort by Filename and you should have all the folders at the top and you can see what might have been added, moved or deleted:
Added: This is a simple copy left to right in WinMerge
Moved: To do it nicely we need to switch out and use windows explorer to move the existing folders. Use this technique from the SVN docs to move working folders
If you want to move files inside a working copy, use the drag-and-drop handler:
1. select the files or directories you want to move
2. right-drag them to the new location inside the working copy
3. release the right mouse button
4. in the popup menu select Context Menu -> Move files in Subversion to here.
Deleted: To do this properly you need to switch out to explorer and use the right mouse context menu and select SVN -> Delete on the working copy.
4) Once the folders have been added, moved and deleted, run the compare again as files within moved folders should be recompared to make sure the contents within the folders are synchronised. WinMerge will still list deleted folders as they exist within the working copy but if you've done them all properly at the point we commit the merge these folders will disappear.
5) Sort by Comparison results again and transfer all different and new files from the left to the right. Any files that only exist in the right can be deleted direct within WinMerge as the commit will remove them from the SVN repository.
6) Now it should all be done, so close WinMerge and right click SVN Commit on the ofbiz_local_current folder. Click the "Select / deselect all" checkbox so it is fully ON i.e. not ghosted, add a comment like ">>>>>>>>>> r483333 (Apache SVN) OFBiz "current" updated to the latest revision" and click OK. All going well it should process away and finish without errors.
If you want to check you can run another WinMerge comparison on the two folders and they should now have no differences. At this point you have update OFBiz in your local SVN repository to match the revision you exported and the next stage is to propagate that new version into any custom branch you choose as described next.
Custom Branch updates
1. Branch Update
Next comes the fun of merging in updates from the local current OFBiz into the custom project. Make sure you have a clean up to date working copy of both projects ofbiz_local_current and customofbiz_local_current as the merge will be done into the custom working folder.
If like me you can't remember the exact version of your last branch update right click on customofbiz_local_current and select SVN -> Show log, from there you should be able to see the most recent comment like "CO ---- Merged OFBiz "current" rXXXXXX (Apache SVN) into CO", take note of the number for the next step.
Right click on custom_local_current and select SVN -> Merge
Set the From URLs to :
Now click "Show log" and select the last merged revision in this example for me it was 5 as it is the local SVN revision number. Use the number noted from the last step to select the correct revision, that's why we put the numbers in the commit comment i.e. r483333.
For the To URL you need to uncheck the "Use ...." box and then enter :
The revision can remain on HEAD for this as we know that it is the revision we want to merge but you could select another revision if desired.
Just check the bottom box lists your local working folder correctly as the destination and the repository it points to for us is correct as svn://localsvn.mydomain.com/custom/customofbiz/trunk
Ready to go so click "Merge" or "Dry run" if you're feeling really nervous! The "Merge" doesn't commit it only changes your working copy so even if there are problems you can handle them before you decide to commit the merge to the local SVN.
When commiting this merge put a comment like "CO ---- Merged OFBiz "current" r483333 (Apache SVN) into CO" so you can find the version number when you come to do the next update for this project.