repository.py: cleaner workflow in init_repository()