mergestate: use dirstate.update_file API in recordupdates()

Let's use the new single function to replace multiple different functions. This
is part of dirstate API refactor to make it more clearer and generic so that it
can be replicated in Rust.

Differential Revision:
16 jobs for topic/default/dirstate-update-file-API in 68 minutes and 5 seconds (queued for 40 minutes and 23 seconds)