'Import a repo from a fast-export file in a temporary directory.
:param name: The name of the repository export file, relative to
dulwich/tests/data/repos.
:returns: An initialized Repo object that lives in a temporary
directory.'

def import_repo(self, name):

    path = import_repo_to_dir(name)
    repo = Repo(path)
    def cleanup():
        repo.close()
        rmtree_ro(os.path.dirname(path.rstrip(os.sep)))
    self.addCleanup(cleanup)
    return repo
