Fix bitbucket repo parsing and add tests.