def make_archive(name, repo, ref, destdir):
output_path = os.path.join(destdir, name + '<STR_LIT>')<EOL>with tmpdir() as tempdir:<EOL><INDENT>cmd_output('<STR_LIT>', '<STR_LIT>', repo, tempdir)<EOL>cmd_output('<STR_LIT>', '<STR_LIT>', ref, cwd=tempdir)<EOL>rmtree(os.path.join(tempdir, '<STR_LIT>'))<EOL>with tarfile.open(output_path, '<STR_LIT>') as tf:<EOL><INDENT>tf.add(tempdir, name)<EOL><DEDENT><DEDENT>return output_path<EOL>
Makes an archive of a repository in the given destdir.

    :param text name: Name to give the archive.  For instance foo.  The file
    that is created will be called foo.tar.gz.
    :param text repo: Repository to clone.
    :param text ref: Tag/SHA/branch to check out.
    :param text destdir: Directory to place archives in.