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.
removing bthis update spans a branch affecting the following files: baborting update spanning branches!(use update -m to merge across branches or -C to lose changes)