Convert `chooseBranchesToMerge` to Cadence.

See #375.