Fixed unicode/bytes/str problems.

Implemented context-manager (with) statements for every open().
Generalized git-specific code.
Removed redundant injections of VCS-specific code.