Repsol to buy rest of North Sea JV, settling dispute with Sinopec