Working with a Subversion branch

In case you are not familiar, a Subversion branch is a different line of development which has the contents copied from the main line and is, therefore, identical to it until more development is done on this new branch.

The typical case is where the developer creates a branch to used for bugfixes to a version with no further development planned while the main branch, or HEAD, goes on with new features.

This recipe will show how to create a branch.

Getting ready

For more information on how to setup NetBeans and Subversion, please, refer to the first Getting Ready section at the beginning of this chapter.

How to do it...

Let's perform the following steps to create a new branch:

  1. Right-click on the project node and select Subversion and Copy To....
  2. On Repository Location click on Browse....
  3. Once Browse for Repository Folders pops-up and loads, select the root node and click Into a new Folder.
  4. On the Specify New Folder enter NBCookbookSVN-V1 and click OK.
  5. Back on browse Repository Folders, click OK.
    How to do it...
  6. Then on the Copy window enter a Copy Description, such as Release 01-01-2011 and click Copy.
How to do it...

How it works...

By visiting your Subversion server, in our case Sourceforge, we can check that the branch was successfully created.

There's more...

Merging a branch back into MAIN.

Merging branches

Branching a project is very important for all the benefits that it brings, such as fixing certain bugs or introducing features specific for some usage. And more often than not we will need to fold those changes back into the main development line. The action of integrating those changes is called merging.

Merging can become quite tricky when product development is far down the line. Especially if that merging is done through the command-line. Having the IDE do some of the hard work and presenting the user with detailed notifications could come in handy.

On this matter NetBeans also includes support for the merging technique.

To perform the merge:

  1. Right-click the project node, select Subversion and Merge Changes....
  2. When the Merge Changes window opens, under Merge From select One Repository Folder.
  3. Then under Repository Folder click on Browse....
  4. On Browse Repository Folders select the desired branch, which in our case is the one we have created, and click OK.
  5. Back on Merge Changes window leave the other fields with their default values and click Merge.
Merging branches

The action we have just performed will bring changes from one of the repository.

Other options provided by NetBeans include bringing changes from Two Repository Folders, as shown in the following screenshot:

Merging branches

And the One Repository Folder Since its Origin option brings changes from the user-specified revision number and when the branch was created:

Merging branches
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.214.194