FDO branches merging - a crash course

Mateusz Loskot mateusz at loskot.net
Tue Aug 29 18:21:43 EDT 2006


Hi,

Recently, I managed to merge new changes from FDORDBMS 'trunk' back to
my private branch 'fdordbms-postgis' (also in FDORDBMS) with success.
So, I'm able to continue work on private development branch and also
have access to latest changes submitted to the 'trunk'.

I decided to write down steps I took to do the merge, so it's
a kind of step-by-step tutorial than may someone find helpful too.

Here it is:

########################################################################################
Step 1: Configuration notes
-------------------------------------------------------------------------------

1. trunk - main development branch

Repository location:
https://fdordbms.osgeo.org/svn/fdordbms/trunk

Working copy location:

$ cd /home/mloskot/dev/fdordbms
$ svn co https://fdordbms.osgeo.org/svn/fdordbms/trunk .

or update if you have it already on your disk:

$ svn up https://fdordbms.osgeo.org/svn/fdordbms/trunk .

2. fdordbms-postgis - private branch

Repository location:
https://fdordbms.osgeo.org/svn/fdordbms/branches/fdordbms-postgis

Working copy location:

$ cd /home/mloskot/dev/fdordbms-postgis
$ svn co https://fdordbms.osgeo.org/svn/fdordbms/branches/fdordbms-postgis .

or update if you have it already on your disk:

$ svn up https://fdordbms.osgeo.org/svn/fdordbms/branches/fdordbms-postgis .


Step 2: What revisions to merge?
-------------------------------------------------------------------------------

1. Update your working copy of fdordbms 'trunk':

$ cd /home/mloskot/dev/fdordbms
$ svn update
...
(Here, you will see list of recently updated/added/removed files in the
trunk.)
Updated to revision 171.

OK, we will want to merge recent changes in 'trunk' of revision 171.

2. Find out what's the latest 'copy' revision of the private branch:

Latest copy revision is a last point in time before 'fdordbms-postgis'
branch
was created, copied or merged. svn log command used with --stop-on-copy
option
will stop as soon as svn log detects that its target was copied or renamed
(for example, branch was create or merged).

$ cd /home/mloskot/dev/fdordbms-postgis
$ svn log --verbose --stop-on-copy
------------------------------------------------------------------------
r167 | mloskot | 2006-08-27 20:33:32 +0200 (Sun, 27 Aug 2006) | 1 line
Changed paths:
   M /branches/fdordbms-postgis/Providers/GenericRdbms/configure.in

FDO118 Removed UnitTest directory before merging latest changes from
fdordbms/trunk.
...
...
Here you will likely see long output of svn log command, so you need to
scroll up to see the highest revision number.

In this example, the latest revision of 'fdordbms-postgis' private
branch before
it was merged with 'trunk' last time (or created) is 167.

3. Finally, we know what revisions to merge.

We're going to copy all changes, from 'trunk' to 'fdordbms-postgis' branch,
that have been applied to 'trunk' *after* private branch was created.
At the end, all changes applied to the 'trunk' between revision 167 and 171
will be merged to the private 'fdordbms-postgis' branch.
So, the developer that works on private branch is able to continue
doing it with avaiability latest features and fixes submitted to the trunk.


Step 3: Merging
-------------------------------------------------------------------------------

1. Run merge in dry-run

First, it's highly recommended to merge in "dry run", to see how
many files will cause conflicts and to have some time to
prepare for potential troubles, etc.

NOTE: We will run merge command from the private branch working copy folder,
'fdordbms-postgis' in this example.

Command details:
svn merge --dry-run - Run merge without applying any changes, a
simulation mode
-r 167:171          - Specification of revisions that will be merged
https://...         - URL of the 'trunk', source of new changes we want
to merge into the private branch

Run merging in dry-run:

$ cd /home/mloskot/dev/fdordbms-postgis
$ svn merge --dry-run -r 167:171
https://fdordbms.osgeo.org/svn/fdordbms/trunk/Providers/GenericRdbms
C    Src/UnitTest/MySqlInit.txt
U    Src/UnitTest/MySql/MySqlConnectionUtil.cpp
U    Src/UnitTest/OdbcInit.txt
....
(Here, list of files being copied/merged into the private branch)

As you can see, Src/UnitTest/MySqlInit.txt file cause conflict (C),
so we *will* need to merge it manually in editor, after decide to run
merge in non-dry-run (see below).

2. Run final merge

After dry-run, we know what files will cause conflics during the merge,
we also know if there are any more serious problems.
If everything seems fine, we can run final merge.

The command is the same as above, with one small difference - without
--dry-run option.


$ cd /home/mloskot/dev/fdordbms-postgis
$ svn merge -r 167:171
https://fdordbms.osgeo.org/svn/fdordbms/trunk/Providers/GenericRdbms
C    Src/UnitTest/MySqlInit.txt
U    Src/UnitTest/MySql/MySqlConnectionUtil.cpp
U    Src/UnitTest/OdbcInit.txt
....
(Here, list of files being copied/merged into the private branch)

Now, have to edit files which caused conflicts and decide how to merge it
(what changes to leave, what to remove).
For details, see following websites:
http://svnbook.red-bean.com/nightly/en/svn.branchmerge.copychanges.html#svn.branchmerge.copychanges.bestprac.merge
http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.resolve


Step 4: Final commit
-------------------------------------------------------------------------------

Now, we can commit new changes back to the repository, to the
'fdordbms-postgis' branch.

svn ci -m "FDO118 Merged changes from between r171 and r167, from trunk
into fdordbms-postgis branch."

The End
########################################################################################


If you have any questions or comments, please post them as a reply to
this thread, so other users have a chance to find them too.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net




More information about the Fdo-internals mailing list