cmdrewrite: use context manager for some locks and transactions
These were the trivial cases where I didn't even need to extend the
scope of a transaction or change indentation to fix it.
# utility to setup pythonpath to point into the tested repository
export SRCDIR=`dirname $TESTDIR`
if [ -n "$PYTHONPATH" ]; then
export HGTEST_ORIG_PYTHONPATH=$PYTHONPATH
export PYTHONPATH=$SRCDIR:$PYTHONPATH
else
export PYTHONPATH=$SRCDIR
fi