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.
Validate paths before reading or writing files in repository or working dir.
Fixes security relevant
issue134.
Fixes running 'hg serve' with Windows executable and no explicit template path configured.
PY2EXE executables don't support __file__ but do place the directory of the
shared code library into sys.prefix.
Fixes bug 152.