Re-generate repository data.
Refactor repository_tool.py and improve test coverage.

Created repository_lib.py.