[Vtigercrm-developers] How To: merge changesets between branches

Jeff Kowalczyk jtk at yahoo.com
Tue Mar 21 10:35:03 PST 2006


I just merged our first change on vtigercrm/branches/4.2 to
vtigercrm/branches/4.2_postgresql_integration. Merging changes between
branches: 

a) keeps the diff down for when you're ready to merge a branch back the
other way (retiring the branch).

b) is better than manually modifying your working copy to imitate a
changeset and committing.

It seems that this is the first use of the svn merge command in our
fledgling repository, so I'll document how to do working-copy merges here
for the benefit of others. We have a lot of merging to do between
vtigercrm/branches/4.2 and vtigercrm/trunk before vtigercrm-5.0.0beta1!

(server side merges (between two rev-ranged URLS) are the ultimate for
changeset-preserving history, but we can ease into that at some future
date)

The end result of the following steps is a tidy changeset with links to
various items in trac:

http://vtiger.fosslabs.com/cgi-bin/trac.cgi/changeset/4381


Step 1: Find the changeset you want to merge, on the trunk/branch it occurs:

    svn diff -r 4357:4358 http://jeffk@vtiger.fosslabs.com/svn/vtiger/vtigercrm/branches/4.2
    Index: modules/Import/ImportStep4.php
    ===================================================================
    --- modules/Import/ImportStep4.php      (revision 4357)
    +++ modules/Import/ImportStep4.php      (revision 4358)
    @@ -89,7 +89,7 @@
     {
            $has_header = 1;
     }
    -if($_REQUEST['modulename'] != '')
    +if(isset( $_REQUEST['modulename']) && $_REQUEST['modulename'] != '')
            $_REQUEST['module'] = $_REQUEST['modulename'];

     if (! isset( $_REQUEST['module'] ) || $_REQUEST['module'] == 'Contacts')
    @@ -239,23 +239,21 @@
     {
            $datarows = $xrows;
     }
    -if($_REQUEST['skipped_record_count'] != '')
    +if(isset($_SESSION['skipped_record_count']) && $_REQUEST['skipped_record_count'] != '')
            $skipped_record_count = $_REQUEST['skipped_record_count'];
     else
            $_REQUEST['skipped_record_count'] = 0;

    -if($_REQUEST['noofrows'] != '')
    +if(isset($_REQUEST['noofrows']) && $_REQUEST['noofrows'] != '')
            $totalnoofrows = $_REQUEST['noofrows'];
     else
            $totalnoofrows = count($datarows);

    -$loopcount = ($totalnoofrows/$RECORDCOUNT)+1;
    -
    -if($_REQUEST['startval'] != '')
    +if(isset($_REQUEST['startval']) && $_REQUEST['startval'] != '')
            $START = $_REQUEST['startval'];
     else
            $START = $_SESSION['startval'];
    -if($_REQUEST['recordcount'] != '')
    +if(isset($_REQUEST['recordcount']) && $_REQUEST['recordcount'] != '')
            $RECORDCOUNT = $_REQUEST['recordcount'];
     else
            $RECORDCOUNT = $_SESSION['recordcount'];


Step 2: merge the changeset (revision range + URL) to your working copy:

    $ svn merge -r 4357:4358 http://jeffk@vtiger.fosslabs.com/svn/vtiger/vtigercrm/branches/4.2
    U    modules/Import/ImportStep4.php


Step 3: diff your working copy with merged changes to the repository URL 

    $ svn diff modules/Import/ImportStep4.php
    Index: modules/Import/ImportStep4.php
    ===================================================================
    --- modules/Import/ImportStep4.php      (revision 4380)
    +++ modules/Import/ImportStep4.php      (working copy)
    @@ -89,7 +89,7 @@
     {
            $has_header = 1;
     }
    -if($_REQUEST['modulename'] != '')
    +if(isset( $_REQUEST['modulename']) && $_REQUEST['modulename'] != '')
            $_REQUEST['module'] = $_REQUEST['modulename'];

     if (! isset( $_REQUEST['module'] ) || $_REQUEST['module'] == 'Contacts')
    @@ -239,23 +239,21 @@
     {
            $datarows = $xrows;
     }
    -if($_REQUEST['skipped_record_count'] != '')
    +if(isset($_SESSION['skipped_record_count']) && $_REQUEST['skipped_record_count'] != '')
            $skipped_record_count = $_REQUEST['skipped_record_count'];
     else
            $_REQUEST['skipped_record_count'] = 0;

    -if($_REQUEST['noofrows'] != '')
    +if(isset($_REQUEST['noofrows']) && $_REQUEST['noofrows'] != '')
            $totalnoofrows = $_REQUEST['noofrows'];
     else
            $totalnoofrows = count($datarows);

    -$loopcount = ($totalnoofrows/$RECORDCOUNT)+1;
    -
    -if($_REQUEST['startval'] != '')
    +if(isset($_REQUEST['startval']) && $_REQUEST['startval'] != '')
            $START = $_REQUEST['startval'];
     else
            $START = $_SESSION['startval'];
    -if($_REQUEST['recordcount'] != '')
    +if(isset($_REQUEST['recordcount']) && $_REQUEST['recordcount'] != '')
            $RECORDCOUNT = $_REQUEST['recordcount'];
     else
            $RECORDCOUNT = $_SESSION['recordcount'];


Step 4: commit your working copy with merged changes, including a commit
message that references/closes any applicable trac tickets.

    $ svn commit -m 'refs #62 and #17. merging changeset r4358 to vtigercrm/branches/4.2_postgresql_integration' modules/Import/ImportStep4.php
    Sending        modules/Import/ImportStep4.php
    Transmitting file data .
    Committed revision 4381.







More information about the vtigercrm-developers mailing list