GOAL: draft for a quick start guide to set up a simple strategy that allows to maintain a customized version of OFBiz under SVN revision control and synchronized with the standard OFBiz SVN
Note: this strategy is a simple implementation of the Vendor Branch Pattern; for more details about Vendor Branches refer to the "Version Control with Subversion" manual.
This is only a draft, I'm testing this strategy right now and I'm not an SVN expert so... your feedback is really welcome!!!
Details: let's say I need to develop a customized version of OFBiz called customofbiz, but I want to stay up to date with the official OFBiz development. I'll do the update once every month.
First of all I'll get OFBiz from svn (let's say rev 5000); then I'll import it into my own svn repository as the ofbiz project; I'll also tag it as ofbiz 5000;
then I'll use it as the base for my customofbiz project; then I'll do all the customization I need to the customofbiz project;
next month I'll get the latest OFBiz revision, let's say 5100, from the official svn and I'll update the ofbiz project in my own repository with it (also adding a tag to it, for example ofbiz 5100);
finally I'll do a merge between ofbiz 5000, ofbiz 5100 and my working copy (containing the up to date customofbiz project); I'll resolve the conflicts and commit everything to svn customofbiz
Repository structure
Here is the repository structure I'll maintain:
ofbiz
ofbiz/current
---> this will contain the latest official OFbiz release
ofbiz/ofbiz-<revnumA>
---> these are the monthly tags for the official OFbiz release (e.g. ofbiz-5000, ofbiz-5100, etc...)
ofbiz/ofbiz-<revnumB>
...
ofbiz/ofbiz-<revnumN>
customofbiz
customofbiz/trunk
---> this is the trunk of the customofbiz project (initially will be the same of ofbiz <revnumA>)
How to set up an SVN repository and start the svn service
- Initialization of an empty repository
svnadmin create ./svn-repos
- Edit the ./svn-repos/conf/svnserve.conf file
- Edit the ./svn-repos/conf/passwd file
- Start the service
svnserve --daemon --root ./svn-repos
Import OFBiz for the first time and create the customofbiz project
- We get the latest official revision of OFBiz (r5000)
svn export http://svn.ofbiz.org/svn/ofbiz/trunk ./tmpdir/ofbiz-5000
- We import it as the ofbiz project in the repository
Tip: the .svnversion/conf file should be equals to the standard ofbiz file except for the svn:keywords properties that should completely removed to avoid merging problems later on
svn import -m "Import OFBiz 5000" ./tmpdir/ofbiz-5000 svn://localhost/ofbiz/current
- We make a tag for ofbiz 5000
svn copy -m "Tag 5000 vendor drop" svn://localhost/ofbiz/current svn://localhost/ofbiz/ofbiz-5000
- We create the "ofbizcustom" project (initially it's a copy of the OFBiz 5000 tag)
svn mkdir -m "" svn://localhost/customofbiz svn copy -m "OfbizCustom is initially built over the ofbiz-5000 tag" svn://localhost/ofbiz/ofbiz-5000 svn://localhost/customofbiz/trunk
Working with the customofbiz project
- We checkout the trunk of customofbiz
svn co svn://localhost/customofbiz/trunk ./tmpdir/customofbiz
- We make local changes to customofbiz and then we commit the new revisions etc...
How to synch customofbiz with ofbiz every month
- Every month we get a new OFBiz revision (in this example, we get revision 5100)
svn export http://svn.ofbiz.org/svn/ofbiz/trunk ./tmpdir/ofbiz-5100
- And we update our current version of the "ofbiz" project in our svn repository and we automatically create also a tag (5100, see the -t argument)
question: are the svn properties that need to be applied to new files correctly retrieved from the .svnversion/conf file?
./svn_load_dirs.pl -t ofbiz-5100 svn://localhost/ofbiz current ./tmpdir/ofbiz-5100
answer: probably not; you have to setup a config file (as described at the bottom of this page) and pass it to the svn_load_dirs.pl script with the -p argument. - We have to synch customofbiz, that was based on the ofbiz-5000 tag, with the ofbiz tag ofbiz-5100; we do this in our working copy, not in the repository (before doing this, make sure that your working directory has no local changes and it is updated).
svn merge svn://localhost/ofbiz/ofbiz-5000 svn://localhost/ofbiz/ofbiz-5100 ./tmpdir/customofbiz
- Fix in your local copy all the conflicts, test and then commit your changes.
- It is also a good idea to tag the new customofbiz revision.
svn copy -m "OfbizCustom is initially built over the OFBiz 5000 tag" svn://localhost/customofbiz/trunk svn://localhost/customofbiz/customofbiz-5100
- Continuing with the example, let's say that one month later, I export a new OFBiz release (5200) and import it with (svn_load_dir.pl) in the ofbiz/current and as a new tag ofbiz-5200; I'll use the following command to perform the merge (thanks to Kenneth Porter for the tip):
svn merge svn://localhost/ofbiz/ofbiz-5100 svn://localhost/ofbiz/ofbiz-5200 ./tmpdir/customofbiz
Tip: export a local svn rather than direct from the OFBiz SVN server
Taking a complete snapshot from the live SVN server every merge can be a long job and place additional load on those servers. The export process describe above can also be done from a locally held OFBiz version that you update using standard "svn up" command.
- First time round do a clean checkout to a local folder "ofbiz_clean"
svn co https://svn.ofbiz.org/svn/ofbiz/trunk ofbiz_clean
- Next export the local "ofbiz_clean" rather than the OFBiz SVN server
svn export ofbiz_clean ./tmpdir/ofbiz-5000
- Then you follow on with the instructions above to import and merge until you come to your next update at which point you
svn up ofbiz_clean
- and then again export the local copy
svn export ofbiz_clean ./tmpdir/ofbiz-5100