Skip to content

Add link to merge requests in Blame page

What does this MR do?

Add link to merge requests in Blame page

Are there points in the code the reviewer needs to double check?

  • UX
  • Query performance
Query SELECT merge_requests.id AS id, merge_requests.target_project_id AS target_project_id, merge_requests.iid AS iid, merge_requests.title AS title, merge_request_diff_commits.sha AS sha FROM "merge_requests" INNER JOIN "merge_request_diffs" ON "merge_request_diffs"."id" = "merge_requests"."latest_merge_request_diff_id" INNER JOIN "merge_request_diff_commits" ON "merge_request_diff_commits"."merge_request_diff_id" = "merge_request_diffs"."id" WHERE "merge_requests"."target_project_id" = 1 AND "merge_request_diff_commits"."sha" IN ( '\x1a0b36b3cdad1d2ee32457c102a8c0b7056fa863', '\x4a24d82dbca5c11c61556f3b35ca472b7463187e', '\x9ff08fa947b96d84a177563c7cc5f3c8fcc46118') ORDER BY "merge_requests"."iid" ASC;
Query plan QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sort (cost=395.10..395.19 rows=38 width=94) (actual time=0.638..0.644 rows=79 loops=1) Sort Key: merge_requests.iid Sort Method: quicksort Memory: 37kB -> Nested Loop (cost=61.50..394.10 rows=38 width=94) (actual time=0.348..0.602 rows=79 loops=1) -> Hash Join (cost=61.23..338.33 rows=82 width=29) (actual time=0.344..0.417 rows=79 loops=1) Hash Cond: (merge_request_diff_commits.merge_request_diff_id = merge_request_diffs.id) -> Bitmap Heap Scan on merge_request_diff_commits (cost=13.87..289.85 rows=82 width=25) (actual time=0.043..0.093 rows=79 loops=1) Recheck Cond: (sha = ANY ('{"\\x1a0b36b3cdad1d2ee32457c102a8c0b7056fa863","\\x4a24d82dbca5c11c61556f3b35ca472b7463187e","\\x9ff08fa947b96d84a177563c7cc5f3c8fcc46118"}'::bytea[])) Heap Blocks: exact=61 -> Bitmap Index Scan on index_merge_request_diff_commits_on_sha (cost=0.00..13.85 rows=82 width=0) (actual time=0.033..0.033 rows=79 loops=1) Index Cond: (sha = ANY ('{"\\x1a0b36b3cdad1d2ee32457c102a8c0b7056fa863","\\x4a24d82dbca5c11c61556f3b35ca472b7463187e","\\x9ff08fa947b96d84a177563c7cc5f3c8fcc46118"}'::bytea[])) -> Hash (cost=35.49..35.49 rows=949 width=4) (actual time=0.291..0.291 rows=950 loops=1) Buckets: 1024 Batches: 1 Memory Usage: 42kB -> Seq Scan on merge_request_diffs (cost=0.00..35.49 rows=949 width=4) (actual time=0.003..0.157 rows=950 loops=1) -> Index Scan using index_merge_requests_on_latest_merge_request_diff_id on merge_requests (cost=0.28..0.67 rows=1 width=77) (actual time=0.002..0.002 rows=1 loops=79) Index Cond: (latest_merge_request_diff_id = merge_request_diffs.id) Filter: (target_project_id = 1) Planning time: 0.574 ms Execution time: 0.702 ms

Why was this MR needed?

This feature helps users to find MRs related to the lines in blame page and reduces the click counts to open the MR.

Screenshots (if relevant)

mr-in-blame-04

Does this MR meet the acceptance criteria?

Edited by Hiroyuki Sato

Merge request reports