Fullscreen
Loading...
 
Skip to main content

History: Copy a change from one branch to another

Source of version: 23 (current)

Copy to clipboard
The Tiki ((Version lifecycle)) uses different branches (ex: trunk, 4x, proposals/4x) which have different levels of maturity and stability. The disadvantage is that you often need to take a change made on one branch, and reproduce it on another branch.

This page explains how to do this, either with the SVN command line, or with Eclipse.

!Terminology

In the rest of this page, we will use the following terminology

* __Origin branch:__ The branch which has the change you want to reproduce on another branch.
* __Origin project:__ The Eclipse project which you use to work on the __Origin branch__(see above definition).
* __Destination branch:__ The branch on which you want to reproduce the change.
* __Destination project:__ The Eclipse project which you use to work on the __Destination branch__(see above definition).

!With SVN command line

Please help by writing instructions for this here.

Here is an example: ((Commit to a proposals branch))

!With Eclipse

Suppose you made and committed a change on __trunk__, and you want to reproduce it in __proposals/4x__, so that the Quality team can look at it and decide if it should be backported to the Tiki4 release.

Here's how you would do it.

!!Make sure your change is committed to the [#Terminology|Origin Branch]
If a change only exists on your local working copy of a branch, you cannot reproduce that change on another branch. So, the first step it to commit your change to the SVN repository.

!!Find the revision number of your change
*Go to the Eclipse  Resources perspective, 
*Right click on the [#Terminology|Origin Project] (tiki-trunk  in this case).
* __Team > Show history__

This will show a recent history of changes made to the project.
{img fileId=2271}
Locate the revision number of the change you want to reproduce in the [#Terminology|Destination Branch] (24025 in this case).

!!Commit any unccommited changes that may reside in your [#Terminology|Destination Project]
If you have some changes in your [#Terminology|Destination Project] which need to be commited, do that first, before you attempt to reproduce a change from the [#Terminology|Origin Branch].

!!Refresh the [#Terminology|Destination Project]
If you __Destination project__ is out of sync with what's on the file system (ex: if Tiki changed the cache files), the __Merge__ dialog may fail. So it's a good idea to always refresh that project first.

* In the Eclipse Resource perspective, right click on the [#Terminology|Destination Project].
* __Refresh__

!!Invoke the Merge dialog
* In the Eclipse Resources perspective, right click on the [#Terminology|Destination project] (proposals/4x in this case).
* __Team > Merge__
{IMG(attId="85")}{IMG}
* In the Merge dialog
** Click on the __Select__ button, then navigate to the [#Terminology|Origin branch] (trunk in this case)
** Click on __OK__ button
{img fileId=2269}
** In the __To: (end URL and revision of range to merge)__ section:
*** Make sure the __Use "From:" url__ box is checked.
*** Make sure the __Merge from HEAD revision__ is left unchecked
*** In the __Revision__ field, enter the revision for the change you want to reproduce. In this case, that is 24025.
** Click on the __Merge__ button.

!!Inspect the changes made on the [#Terminology|Destination Project]
* In the Eclipse Resource perspective, right click on the [#Terminology|Destination Project] (prop-tiki4 in this case).
* __Compare With > Base Revision__
* In the __Structure compare__ section, double click on each file in turn, and make sure that the diff is a change that you intended.
* In some cases, you may notice that your local copy has several versions of a same file, with suffixes __.merge-left.rN__, __.merge-right.rN__ and __.working__ (where N represents the revision number of the change you want to reproduce).
** This indicates that there was a conflict between the two branches for that file, and that you need to manually resolve it.
{IMG(attId="87")}{IMG}
** The easiest thing is to edit the actual file (__multilinguallib.php__ in this screen shot). In each section where some diffs were encountered, you will see two versions, enclosed in the following tags

{CODE()}
<<<<<<< .working
Code as it used to be in the Destination Branch.
=======
Code as it appears in the Origin Branch, after the change that
you want to reproduce on the Destination Branch.
>>>>>>> .merge-right.rN
{CODE} 

** Simply figure out what this part of the code should be in the [#Terminology|Destination Branch], and remove the tags.
Show PHP error messages