Explicit interfaces for MergeTrain domain
"Follow-up from "Preserve merge train history""
The following discussion from !19864 (merged) should be addressed:
-
@fabiopitino started a discussion: (+1 comment) I see this is a commonly used method and changing it may require quite some refactoring but I have one consideration (you probably have thought about it already).
I find unclear that we are passing in 1 merge request to this method to get a list of other merge requests. I think it may be more explicit to pass in the actual data needed which reduces drastically the interface this method depends on for
MergeRequest.Ideally we would pass in a
MergeTrain::Targetobject, composed of:project, :branch, but if that is too much of overhead we could call this method asMergeTrain.all_active_mrs_in_train(target_project: mr.target_project, target_branch: mr.target_branch). As reader I would find this more explicit and I understand that it pulls MRs based on specific target criteria.See a similar usage already here: !19864 (diffs)