Catch OSError when a folder can't be read.

When traversing a directory tree, e.g. the project root, and a
directory is not readable anymore, catch and ignore this error.
Remove remainder of the Mercurial metadata.
Clean up test directory after test run.