Skip to content

Support search by "source branch" on MR list page

What does this MR do and why?

Tier: GitLab Free

Environment: ~SaaS self-managed

Related issue: #213177 (closed)

Related Jihu Epic: https://jihulab.com/groups/gitlab-cn/-/epics/5470

Support search by source branch on the MR list page.

SQL changes involved

Every time we use the source branch query on the UI, these two SQL will be executed:

SELECT
  COUNT(*) AS "count_all",
  "merge_requests"."state_id" AS "merge_requests_state_id"
FROM
  "merge_requests"
WHERE
  "merge_requests"."target_project_id" = 6
  AND "merge_requests"."source_branch" = 'dev'
GROUP BY
  "merge_requests"."state_id"


SELECT
  "merge_requests".*
FROM
  "merge_requests"
WHERE
  "merge_requests"."target_project_id" = 6
  AND ("merge_requests"."state_id" IN (1))
  AND "merge_requests"."source_branch" = 'dev'
ORDER BY
  "merge_requests"."created_at" DESC,
  "merge_requests"."id" DESC
LIMIT
  20 OFFSET 0

Screenshots or screen recordings

Before After

How to set up and validate locally

Just switch to the current branch support-source-branch-filter and enter the MR list page of any Project or Group.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.


cc @prajnamas @mtan-gitlab @icbd

Edited by Zhiyuan Lu

Merge request reports

Loading