def overlay(repository, files, version, debug=False):
with util.saved_cwd():<EOL><INDENT>os.chdir(repository)<EOL>_get_version(version, debug)<EOL>for fc in files:<EOL><INDENT>if '<STR_LIT:*>' in fc.src:<EOL><INDENT>for filename in glob.glob(fc.src):<EOL><INDENT>util.copy(filename, fc.dst)<EOL>msg = '<STR_LIT>'.format(<EOL>version, filename, fc.dst)<EOL>util.print_info(msg)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if os.path.isdir(fc.dst) and os.path.isdir(fc.src):<EOL><INDENT>shutil.rmtree(fc.dst)<EOL><DEDENT>util.copy(fc.src, fc.dst)<EOL>msg = '<STR_LIT>'.format(<EOL>version, fc.src, fc.dst)<EOL>util.print_info(msg)<EOL><DEDENT><DEDENT><DEDENT>
Overlay files from 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 files: A list of `FileConfig` objects.
:param version: A string containing the branch/tag/sha to be exported.
:param debug: An optional bool to toggle debug output.
:return: None