Merge Requests
A merge request is a way for users to send their changes from one tracker to another tracker (or branch) even when they have no permission to modify items on the target tracker. A user commonly creates his own branch from a tracker. He changes some of the items, adds new items, then wants to move those changes to the parent branch. When the user has permission to add and update items on the parent branch, the user can simply merge the changes.
Sometimes the project administrator may restrict read access to the parent branch. This is where the merge request feature comes in handy. With a merge request, the user can ask other users that have write permission on the parent branch to review the changes and merge them to the target.
A merge request is a set of work items. For a merge request you can assign reviewers and moderators. The reviewers and moderators review the changes and then a moderator merges the approved items to the target branch.
Sending a Merge Request
You can create a merge request from several places in Codebeamer. The Send Merge Request menu option is available in the following locations:
• In the more menu of trackers and branches
• On the KanBan board
• On the report details page
• On the Review Hub
To send a merge request, click Send Merge Request from any of the places listed above. This launches a window that guides you through the merge request creation process.
In the first step of the process, select the target tracker where you want your changes to be merged. When you are sending the merge request from a branch, the parent branch is selected by default. If you check the Include only suspected items checkbox then only the items that are suspected are included in the merge request.
The second step shows the differences between the source and the target branch, similar to the following image:
The third step provides statistics about the items in the merge request as shown in the following image. From this step, you must also specify the name for the merge request.
In the fourth step, you can add reviewers and moderators to the merge request. These two type of users have different permissions:
• The moderators can modify the merge request. They can add new users, change the merge request name, and change other properties. They can also review the items in the merge request. The most important difference from reviewers is that only a moderator can merge a merge request.
• The reviewers can only review (accept or reject items) but cannot modify or merge the merge request.
The final step in the wizard provides an overview of the items that are included in the merge request. If everything is correct, click Create Review .The merge request is created.
Working with a Merge Request
Merge requests can be found in two places. First, under Review Hub there is a Merge Requests submenu as shown in the following image:
This submenu opens a page with all the open merge requests to which you have access.
This page provides useful information about each merge request, including the target tracker.
You can also access the incoming merge requests for a tracker (those merge requests where the tracker or branch is the target) from the tracker page header and from the more menu of a tracker. When a tracker has open incoming merge requests, the tracker header shows a clickable badge labeled Pending Merge Requests. This opens a window with the list of open merge requests for that tracker.
Reviewing the Changes
One of the most important phases of a merge request is reviewing the changes. All reviewers and moderators for the merge request can accept or reject the items in the merge request, except those for which they have no read permission. The merge request review page is very similar to the
Review HUB.
Merging the Changes
A moderator can merge the approved changes to the target branch. An item is approved when all the reviewers who voted on it approved it (no one rejected it). When a moderator clicks the Finish button, there are three choices, as shown in the following image:
• Merge: Show the merge screen with all the approved items.
• Finish Merge Request: Closes the merge request without merging the changes.
• Restart Merge Request: Restarts the merge request. If the items in the merge request have newer versions then those newer versions are included in the new request.
Click Merge to open the merge window:
To see and merge only relevant changes, choose from the following Filters:
Report: Select a single report to reduce the displayed merge items. Use this filter carefully because it is possible that the selected report might not contain items from one of the branches. Only those changes are merged that are currently visible.
Apply to side: If you selected a report, the filter is locked to the right (Source) if Created is selected under Difference type.
Difference type: Select from All, Updated, or Created, to filter based on the displayed items. If Updated or All are selected, the Apply to side filter is not restricted to either side.
Field: Select from the available fields to filter the displayed items. This filter applies only to Updated items. The filter is enabled only when All or Updated are selected under Difference type . The filter is not enabled when Created is selected under Difference type. By default, All fields are selected except the ones marked as Omit Merge. This means that by default, items with changes only in omitted fields are not shown.
After you have made your filter selection, click GO.
Mark all as merged: If you select this check box, badges will be removed from all matching items, not only the ones that are shown on the current page. If you select a report and select this check box, only those items are merged that match the selected report and the filter combination. If you select a different report, any earlier check box selection is cleared.
Copy all created: If you select this check box, all items created on the branch and visible only on the current page, will be copied to the target. For items that were created on the Working-Set, you have only one check box. Selecting it will copy the item to the target branch and create a hidden reference between the copy and branch item. From this point you can track the field changes between the items.
For updated items you can select which fields to copy to the target item by clicking the apply button for the field. If you want to copy all field values of an item then click on the Apply button in the row of the name. This will apply all changes. You also have a Mark as merged option for each updated tracker item. This is useful in the cases when you don't want to merge any field changes between the branches but want to acknowledge that the change is not important for you. Clicking this option will clear the badge on the document view without actually merging the changes.
Click Apply All for a bulk update on the current page, or click Apply to merge specific changes.
When you are ready with selecting the changes to apply click the Merge button for the items on the current page. This will apply the selected changes and redirect to the source Working-Set branch. After the selected changes are applied the badges of the merged items are cleared.
If there are items on subsequent pages, repeat the steps for the merge operation, to merge the items on subsequent pages.
To adjust the page size, see .
When the merge request is done between two trackers (not between a tracker and its branch) it is possible that the two trackers has different field definitions. If this is the case then the user may want to define the field mappings before the merge (so that the source values are copies to the appropriate target field). For this reason the merge dialog shows the field mapping box where you can define these mappings:
This dialog shows all the approved items and their difference between the source. This is very similar to the diff page that we use on other pages. The moderator can select the specific changes he wants to merge. When he simply wants to ignore the changes in an item he can just check the Mark as merged checkbox. This will set the item as merged without actually merging the changes.
Clicking the Merge button merges the selected changes, closes the Merge Request and the user is redirected to the Merge Request statistics page. Merging the changes means that the selected modifications are copied to the target tracker. From this point the Merge Request is closed. If there are new changes then the user has to send a new Merge Request including those changes.