add and use fetchpatch

This is a replacement for #2570.