def export(cls, revision, path): url = revision["fetch_url"] commit = revision["commit"] path_, dirname = os.path.split(path) gitdir = os.path.join(path, ".git") os.chdir(path_) git.clone(url, dirname) os.chdir(path) git.checkout(commit) rmtree(gitdir)