compat: patch overlayworkingctx._markdirty() for hg 5.0 and earlier

This is required for the fix for issue6416 (4a09e95d29c9) to work on older
Mercurial versions.
8 jobs for topic/stable/touch-on-5-0 in 4 minutes and 53 seconds (queued for 2 seconds)