How to merge on subversion

In this post we will show how to do a merge between a branch and the trunk.

In a previous post we saw how to use subversion from the command line to manage our project repositories, now we will see how to do merge from a branch to a trunk.

We use branches for new features to be developed, while the trunk is normally used as the main development thread. To do a merge we should use the following commands:

1. Check out a copy of the trunk:

1
user@unix:~$ svn co https://svn.hasheado.com/myProject/trunk

2. Now, we do a check out of the branch we want to merge:

1
user@unix:~$ svn co https://svn.hasheado.com/myProject/branches/1.0.1

3. We should change the work copy to the last branch and find in what revision we are:

1
2
user@unix:~$ cd /path/to/branches/1.0.1
user@unix:~$ svn log --stop-on-copy

This last command should show us the changes those did made since the creation branch. Take note of that number (should be in the way of rXXX, where XXX is the revision number).

4. Change our work copy to the trunk and do an update:

1
2
user@unix:~$ cd /path/to/trunk
user@unix:~$ svn update

That update will update our work copy to the most recient revision, and it will tell us what revision is. We should take note of this revision number (“at revision YYY”).

5. Now, we could simulate the merge:

1
user@unix:~$ svn merge --dry-run -r XXX:YYY https://svn.hasheado.com/myProject/branches/1.0.1

The –dry-run option simulates the merge, but it does not make it, in that way we can see what files will be merged and if we should resolve some conflicts.

6. After review the simulation output, we should do the merge:

1
user@unix:~$ svn merge -r XXX:YYY https://svn.hasheado.com/myProject/branches/1.0.1

7. And at the end, do a commit to the repository:

1
user@unix:~$ svn ci -m "MERGE myProject from branch 1.0.1"

That is all, the merge is done.

NOTE: Take in account that the url used are just samples.

PHP 5.3.3. released

The PHP 5.3.3 was released a few days ago.

The PHP core team has announced the 5.3.3 availability. This release has focused on improve security and stability issues with more than 100 fixed bugs, most of them related to security issues.

Previous versions incompatibility
For previous version than 5.3.3 there is a big incompatibility. The methods with the same name as the class name used by the namespace are not anymore considered as the class constructor. This change does not affect the classes those do not use namespaces.

1
2
3
4
5
6
7
8
9
10
<?php
namespace Foo;
class Bar
{
    public function Bar()
    {
        // Act as constructor in PHP 5.3.0-5.3.2
        // Act as a regular method in PHP 5.3.3
    }
}

This change does not have impact in migrations from PHP 5.2.x, due to namespaces were introduced from PHP 5.3.0.