How to set up SVN repository for bug fixes?

Having been a developer for a number of years, I should know, but I don’t know.

I am working on a released product in a small team. I am the main developer who runs most of the code, but there are a couple of other developers who commit from time to time. We currently have an intermediate server running Hudson CI, which builds after each commit. Production is updated manually using a simple svn up command when the trunk is stable and verified.

This usually works fine, but we have situations that require urgent / urgent changes in production when the code is not completed in the trunk.

How to set up a repo to accommodate this situation? I thought this answer was a good answer, but it is still slightly above my head.

I think when updating production create a branch with this revision. However, if I need to make urgent corrections for production, how can I access this branch and how can I update production by pulling on this branch, and not on the tool? How can I make sure that any urgent corrections for the production branch are also transferred to the trunk?

T. This is a situation in which I want to have a better solution, because it happened several times

  • Rev 1000 updated by product
  • Ed. 1001-1005 are new features / bug fixes that will be included in the next version.
  • Revision 1006 is an urgent solution that needs to be pressed into production
  • Version 1007-1009 are additional feature updates.
  • Version 1010 should be the next version updated for production

Update:

After reading the branch section of the SVN book, I’m thinking about the following setup.

  • Create a branch when you are ready to click on prod

    svn copy /trunk /branches/production_01 -m 'Production release'

  • In production, go to the production branch

    svn switch /branches/production_01

  • If an urgent correction is required, the developer should make changes to the 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

  • In the production process, we update to the last branch

    svn update

Does this process sound as if it will work for our setup?

+7
source share
3 answers

There are various ways to solve this problem, but I think the following was done in the most effective way that I saw:

  • All developers go to branches, fix bugs or new features. These branches are under CI and deployed in their testing environment.
  • The code that must go into Production is merged into the trunk from the branch (error correction branch or function branch). the trunk is also under CI. After testing is approved, it can go to the pre-product, and then to the product. In Production, only the code from the body is issued.

Thus, basically any code that enters the trunk is a merge from a branch; Thus, the trunk only contains the code that needs to be issued, and you do not need to do uncomfortable rollbacks or code branching from the revision.

The downside is that you need different CI environments, with different application server domains for each branch, plus a trunk and pre-prod.

+3
source

Creating a new branch each time to prepare for a production release is necessary in large teams where people still want to test new features for future releases while you try to stabilize for this version. If you do not support more than one product release at a time, this is not necessary for a small team.

In your situation, I would keep one permanent branch of production . Whenever you make a normal release, stabilize it in trunk , merge trunk in production and check and click from there.

To fix, create a new branch from production 1, make your changes to it, then merge it both in production and in trunk . As with your normal release, you test and click production .


1 Always a branch from the oldest branch on which you intend to merge again. This makes the merge a lot cleaner.

+3
source

Indeed, there are many ways to achieve this. The way corrections are applied depends on the general process of version control and project releases. Thus, I will predetermine my answer by describing the basic version control that we use for all our projects:

  • /trunk contains the main development branch that is used for active development, unless extensive work such as new core functions or refactoring occurs. In this case, the developer will make a copy of /branches/foo , and then change to /trunk again when the work is done. The choice of working mainly in /trunk or using branches depends on the number of developers, the complexity of the project, the stage of the project, and the speed of development. In any case, it is better to try to keep /trunk as stable as possible.
  • As soon as a milestone is reached, and work in /trunk is ready for release on the production site, /trunk will be copied, for example, /tags/2.5.0 (version number for this version).
  • This release is first applied to the sandbox site (e.g. test.example.com) using svn switch ^/tags/2.5.0 (note note (^) in the URL;) and shown to the client or QA team for viewing.
  • If adjustments to the client command or QA request are repeated, steps 1-3 are repeated and the minor version number is incremented (for example, to /tags/2.5.1 ).
  • After the sandbox site has been tested and approved for release, the same steps that are used to launch the sandbox site apply to the production site (i.e. svn switch ^/tags/2.5.1 ).

So, in this case, we need to apply an urgent correction for the manufacturer’s website, we:

  • Apply the patch directly to the release version on /tags/2.5.1 , using the local working copy of /tags/2.5.1 or directly on the sandbox site.
  • If the changes were made in the local working copy, we will commit the changes and update ( svn up ) the sandbox site. Then we repeat the review / approval process.
  • Once approved, simply upgrade ( svn up ) the production site.
  • Changes made to the /tags/2.5.1 release version are merged into /trunk again.
+2
source

All Articles