def extract(repository, destination, version, debug=False):
with util.saved_cwd():<EOL><INDENT>if os.path.isdir(destination):<EOL><INDENT>shutil.rmtree(destination)<EOL><DEDENT>os.chdir(repository)<EOL>_get_version(version, debug)<EOL>cmd = sh.git.bake(<EOL>'<STR_LIT>', force=True, all=True, prefix=destination)<EOL>util.run_command(cmd, debug=debug)<EOL>msg = '<STR_LIT>'.format(version, repository,<EOL>destination)<EOL>util.print_info(msg)<EOL><DEDENT>
Extract the specified repository/version into the given directory and
return None.

:param repository: A string containing the path to the repository to be
 extracted.
:param destination: A string containing the directory to clone the
 repository into.  Relative to the directory ``gilt`` is running
 in. Must end with a '/'.
:param version: A string containing the branch/tag/sha to be exported.
:param debug: An optional bool to toggle debug output.
:return: None