Managing MRs
CodeArts Repo supports development of multiple branches and establishes configurable review rules for branch merging. When a developer initiates an MR, some repository members can be selected to participate in code review to ensure the correctness of the merged code.
When a merge request is created, reviewers, approvers, and mergers will be notified by emails and .
Based on the security of the code repository, you are advised to understand and configure the following functions before using merge requests:
- 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 list page.
- You can switch between tabs to view MRs 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 New in the upper left corner to create a request.
Open: The request has entered the review or merge phase, and branches have not been merged.
Merged: indicates that the request is approved and the branch is merged.
Closed: indicates that the request is canceled and the branch is not merged.
All: displays MRs in all states.
Creating a Merge Request
Assume that the administrator has set branch merge rules. To create an MR for a develop branch, perform the following steps:
- Go to the details page of a target repository.
- Switch to the Merge Requests tab page.
- Click New and select the branch to be merged.
In the preceding figure, Dev (where the development task is completed) is merged into the master branch.
The branch of a forked repository can be selected as the source branch.
- Click Next. The system checks whether the two branches are different.
- If there is no difference between the two, the system displays a message and the MR 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.
- Set the parameters according to the following table.
Table 1 Parameter description Parameter
Description
Change Branch
Click to return to the previous step and change the branch to be merged.
Title
Enter the MR title.
Description
A default description is generated based on the merge and commit messages of the source branch. You can modify the description as required.
Associate Work Items
You can choose to associate a merge action with a work item to automatically change the status of the work item.
Mergers
Mergers have permissions to merge branches (by clicking the merge button) when all approvers 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
Specified to participate in the merge branch review and can raise questions to the initiator.
Approvers
Appointed to participate in the merge branch review. You can provide review comments (approved or rejected) or raise questions to the initiator.
Delete source branch after merge
You can choose whether to delete the source branch after merge. The preset status in the MR settings is initially used.
Squash
Enabling Squash merge keeps the history of the basic branch clean, with meaningful commit messages, and can be easily restored if necessary. For details, see Squash.
- Click Create Merge Request to submit the MR. The details page is displayed.
On the details page, merge rule statuses, mergers, reviewers, approvers, 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.
- Commits: You can view commit records of the source branch.
- Files Changed: You can view the changed content in an MR and filter the change types such as addition, modification, deletion, and renaming.
- Pipeline: You can view the information about the pipeline.
- When an MR is created, related members (reviewers and mergers) will be notified by emails.
- If a single file contains 5000 different lines and there are over 100 different files, you are advised to merge the branch using the client and then push it to CodeArts Repo.
Reviewing, Approving, and Merging MRs
If you are notified of an MR as a reviewer, approver, or merger, perform the following steps:
- Go to the details page of a target repository.
- Switch to the Merge Requests tab and click the name of the target merge request to view details.
- Review the target merge request.
Both the reviewer and approver can review the merge request and provide review comments. If there is no comment, the reviewer can click Review Pass to complete the review.
- Approve the target merge request.
The reviewer can click Reject or Approve.
- Pass the gate.
Table 2 Merge conditions Merge Condition
Description
Code merge conflicts
When the source branch code conflicts with the target branch code, you need to resolve the conflict before proceeding to the next step. For details about how to resolve the code conflict, see Resolving Code Conflicts in an MR.
Review comment gate
After the initiator resolves the reviews of all reviewers or approvers, the gate is passed. For details see Detailed Description of Review Comments Gate.
Pipeline gates
When the latest commit or pre-merged commit starts and successfully executes the pipeline, the gate is passed. For details see Detailed Description of Pipeline Gate.
E2E ticket number not associated
After the combination request is associated with a work item, the gate is passed. For details see Detailed Description of E2E Ticket Number Association Gate.
Review gate
When the number of reviewers reaches the minimum number, the gate is passed. For details see Detailed Description of Review Gate.
Approval gate
When the number of approvers reaches the minimum number, the gate is passed. For details see Detailed Description of Approval Gate.
- Merge the request.
After an initiator meets the preceding conditions, click Merger to merge the request. Otherwise, click Close to close the request.
Squash
Squash is to merge all change commit information of an MR into one and keep a clean history. When you focus only on the current commit progress but not the commit information, you can use squash merge. To better understand this function, perform the following operations:
- Create a repository.
Name it repo.
- Create a branch.
Name it Dev.
- Submit the creation.
Consider creating a file as a commit.
Dev branch: Create two files and name them Function_1 and Function_2.
- Check the effect before Squash is enabled.
Find the Dev branch. Click the Code, Commits, and Commits tabs to view the commit information.
- Create and merge a request.
- Set the source branch to Dev and target branch to master. Create a merge request.
Dev branch: Name the merge request as Code Merge, select Squash, and enter Configure Squash.
- Complete the review and approval.
- Set the source branch to Dev and target branch to master. Create a merge request.
- Check the effect after Squash is enabled.
After the request is successfully merged, click the Code, Commits, and Commits tabs, select the master branch. Compared with Step 4, the committed content has been merged.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot