Include MRs for merge commits for changelogs
What does this MR do?
When generating a changelog, we now include links to merge requests for any merge commits to use as input. Prior to this commit we'd only consider merge requests that contained a commit.
The process of fetching merge requests by their merge SHA is a bit different (and easier) compared to fetching them by their diffs. In this commit we do so using an extra database query, but this query is simple and should not pose any problems.
This fixes gitlab-com/gl-infra/delivery#1579 (closed)
Added query
This MR adds a new query like so:
SELECT "merge_requests".*
FROM "merge_requests"
WHERE "merge_requests"."target_project_id" = 278964
AND "merge_requests"."merge_commit_sha" IN (
'de86174681bbb0f89615616280caeab8a3971075',
'ac847fbaf7d73bc506df8e64c7265d992dab558e',
'015edf12f35f3cf60540edd98458aedeea6e1a9c'
)
This produces this plan:
Index Scan using index_merge_requests_on_tp_id_and_merge_commit_sha_and_id on merge_requests (cost=0.57..7.74 rows=1 width=769) (actual time=0.283..1.260 rows=2 loops=1)
Index Cond: ((target_project_id = 278964) AND ((merge_commit_sha)::text = ANY ('{de86174681bbb0f89615616280caeab8a3971075,ac847fbaf7d73bc506df8e64c7265d992dab558e,015edf12f35f3cf60540edd98458aedeea6e1a9c}'::text[])))
Planning Time: 9.390 ms
Execution Time: 1.300 ms
Does this MR meet the acceptance criteria?
Conformity
Edited by Yorick Peterse