rhg: align the dirstate v2 writing algorithm with python

Use the same algorithm of file append as python does, where we do a manual
seek instead of relying on O_APPEND. (see the reasons in the inline comment)
15 jobs for topic/stable/dirstate-v2-actually-test-append in 57 minutes and 32 seconds (queued for 6 seconds)