fix backtrace printed when cannot get lock.
change lock error handling code so exceptions have useful info and
exception handling in one place.
add test case for when cannot get lock.
#!/bin/sh
mkdir t
cd t
hg init
echo a > a
hg add a
hg commit -m "test" -d "1000000 0"
hg verify
hg parents
hg status
hg undo
hg verify
hg parents
hg status