Being a developer for a number of years this is something I should know but don't.
I am working on a released product on a small team. I am the main developer committing most of the code but there are a couple other developers that commit from time to time. Currently, we have a staging server running Hudson CI that builds after every commit. Production is updated manually by a simple svn up command when the trunk is stable and tested.
This has generally worked fine except we do have situations requiring emergency/urgent changes to production when code is not finalized in the trunk.
How can I setup the repo to accommodate this situation? I thought this response was a good reply but it is still a little over my head.
I am thinking, when updating production, create a branch at that revision. However, if I need to make urgent production fixes, how do I access that branch and how can I update production by pulling from that branch and not trunk? How do I make sure that any urgent fixes for the production branch are also committed to the trunk?
ie. this is the situation I want to have a better solution for because it has occurred a few times
Update:
After reading through the branching section of the SVN Book, I am thinking about the following setup.
Create branch when ready to push to prod
svn copy /trunk /branches/production_01 -m 'Production release'
On production, do a switch to the production branch
svn switch /branches/production_01
If an urgent fix is needed, developer needs to make changes in branch:
svn checkout /branches/production_01
// make changes
svn merge /trunk # make sure changes get merged into trunk as well
svn commit -m 'Urgent fix
On production, update to the latest branch
svn update
Does this process sound like it would work for our setup?
Creating a new branch every time in order to get ready to release to production is necessary in large teams where people still want to check in new features for future releases while you are trying to stabilize for this release. Unless you are supporting more than one production release at a time, that's not really necessary on a small team.
In your situation I would keep one permanent production
branch. Whenever you do a normal release, get it stabilized in trunk
, merge trunk
into production
, and test and push from there.
For a hotfix, create a new branch from production
1, make your changes in there, then merge it both into production
and trunk
. As with your normal release, you test and push from production
.
1 Always branch from the oldest branch you intend to merge back into. It makes the merge much cleaner.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With