apply: plug the three-way merge logic in