How To: merge changesets between branches

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How To: merge changesets between branches

Jeff Kowalczyk
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@.../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@.../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.




_______________________________________________
This vtiger.com email is sponsored by Zoho Planner. Still scribbling down your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled, personal organizer online, Zoho Planner for FREE instead! http://zohoplanner.com/?vt 
Reply | Threaded
Open this post in threaded view
|

Re: How To: merge changesets between branches

Mike Fedyk
Hi Jeff,

Is is possible that you could be the branch merge maintainer?  I've read
through the first half of the svn book, but you have experience here
that is quite valuable and will be an example for everyone to learn from
also.  Most any request that eases merging 4.2 <-> 5.0 will be followed
(like possibly splitting utils.php in 4.2.x like I have heard it is in
5.0) as long as a consensus is reached.

What do you say?

Jeff Kowalczyk wrote:

> 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@.../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@.../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.
>
>
>
>
> _______________________________________________
> This vtiger.com email is sponsored by Zoho Planner. Still scribbling down your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled, personal organizer online, Zoho Planner for FREE instead! http://zohoplanner.com/?vt 
>
>  
_______________________________________________
This vtiger.com email is sponsored by Zoho Planner. Still scribbling down your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled, personal organizer online, Zoho Planner for FREE instead! http://zohoplanner.com/?vt