Updated on 2023-07-25 GMT+08:00

Merge Request Approval

Introduction

CodeHub supports multi-branch development and provides configurable review rules for branch merge requests. When a merge request is created, all repository members can review the branch to ensure the quality of the code to be merged.

Merge Request Settings

There will be no restriction on merge requests if you do not set any rules. You are advised to understand related rules before using this function.

Merge Requests: You can set rules for merging branches.

Protected Branches describes how to configure the merge permission on a protected branch.

Merge Request List

On the Merge Requests tab page, you can view merge requests.

  • You can switch between tabs to view requests in different states.
  • You can click a request to go to the details page.
  • You can view the brief information about the request, including the involved branch, creation time, and creator.
  • You can search for a request based on different conditions.
  • You can click Create Merge Request in the upper right corner to create a request.

Closed: indicates that the request is canceled and the branch is not merged.

Merged: indicates that the request is approved and the branch is merged.

Merge Request Details

  • On the Details tab page, merge rule statuses, mergers, reviewers, and associated work items are displayed. You can view review comments, mark a review comment as Unsolved, and view all activities related to the merge request.
  • On the Commit Records tab page, you can view the commit records of the source branch.
  • On the Files Changed tab page, you can view the changes to be merged and filter changes by type (such as adding, updating, deleting, and renaming).
  • On the CloudPipeline tab page, you can view the information about the pipeline gate.

Creating a Merge Request

Assume that the administrator has set merge rules. To create a merge request for a develop branch, perform the following steps:

  1. Access the repository list.
  2. Click a repository to go to the details page.
  3. Switch to the Merge Requests tab page.
  4. Click Create Merge Request and select the source and target branches for merge.

    In the preceding figure, dev002 (where the development task is completed) is merged into the master branch.

  5. Click Next. The system checks whether the two branches are different.

    • If there is no difference, the system displays a message and the merge request cannot be created.
    • If the branches are different, the following Create Merge Request page is displayed.

    The lower part of the Create Merge Request page displays the file differences of the two branches and the commit records of the source branch.

  6. Enter the title and description.

    A default description is generated based on the merge and commit messages of the source branch. You can modify the description as required.

  7. Set Mergers, Reviewers, and other rules.

    • Mergers: Mergers have permissions to merge branches (by clicking the merge button) when all reviewers approve MRs and all discussed issues are solved (or you can set the rule to allow merge with issues unsolved). They can also close the MR.
    • Reviewers: members assigned to review the merge request. Reviewers can approve or reject the merge request, or raise questions to the requester.
    • Associated Work Items: You can associate a merge with a work item so that the work item status can change automatically.
    • Delete source branch after merge: You can choose whether to delete the source branch after merge. The preset rule is used as the initial setting.
    • Squash: You can choose whether to merge all commits of the merge request into one and keep a clean history.

  8. Click OK to submit the merge request. The Details page is displayed.

    If the requester is also a reviewer, they can directly review the merge request on the Details page.

Reviewing a Merge Request and Performing Merge

  1. Access the repository list.
  2. Click a repository to go to the details page.
  3. Switch to the Merge Requests tab page.
  4. (If you are not a reviewer, skip this step.) Review the merge request.

  5. (Optional) Comment on the submitted content and wait for the initiator to reply.
  6. If the score is higher than the access control score, you can choose whether to delete the source branch. After the operation, the request status changes to Merged (only the merger can perform the merge operation).

    If all reviewers approve the merge request, you can click Merge to merge the branch or click the extension icon on the right of the Merge button to close the request.

Viewing Merge Request Records

  1. After a project team member submits a file, you can view the record on the History tab.

  2. Click a record to view details, compare the file content before and after the modification, view comments, and click OK.

  3. Click the Reviews tab to view records on the Merge Requests tab.