Fix unit tests for mercurial commands

- Includes changes for using rmdir instead of purging the copy
- Includes changes for looking for mercurial locks before pursing with commands
Fix unit test for dependency failure