A new reset_state method is introduced to deal with most of that logic. This
move things one layer lower, but the ultimate goal is to deal with most of this
at the DirstateItem level.
This reveal various imperfection with the data passed to update_file by
mergestate.recordupdates, however this is orthogonal to this patch and should
be dealt with at a higher level.