Update merge API

There have been some changes upstream in the merge API. This PR address the changes and also adds more of the missing primitives needed to handle operations like cherry-picks, rebases, merges and conflict resolution.