Create local ui object per repository, so .hg/hgrc don't get mixed.
This is needed for hooks, but may be important for other settings, too.
Fixes
issue113, also integrated push-hook-lock.sh as a test case for this.
Call hooks in alphabetical (=defined) order, of course still grouped by type.
Output of test-hook adjusted.
make ui flush output. this makes error happen if printing to /dev/full.
before this change, error happened with some pythons, but not others.
now always happens.
fixes issue 155.