Import from fossil 3 way merge code