patch.py: re-add the ability to use an external patch program
This is now invoked by default only if ui.patch is set. Otherwise, we
use our built-in patch. If that fails because it can't find any valid
hunks, we'll fall back to trying the external patch command.
#!/bin/sh
hg init
mkfifo p
hg serve --stdio < p &
P=$!
(echo lock; echo addchangegroup; sleep 5) > p &
Q=$!
sleep 3
kill -HUP $P
wait
echo .hg/* .hg/store/*