def harvest_repo(root_url, archive_path, tag=None, archive_mode='<STR_LIT>'):
if not svn_exists():<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>clone_path = mkdtemp(dir=cfg['<STR_LIT>'])<EOL>svn = get_which_svn()<EOL>if tag:<EOL><INDENT>call([svn, '<STR_LIT>', root_url + '<STR_LIT>' + tag, clone_path])<EOL><DEDENT>else:<EOL><INDENT>call([svn, '<STR_LIT>', root_url + '<STR_LIT>', clone_path])<EOL><DEDENT>chdir(cfg['<STR_LIT>'])<EOL>tar = tarfile.open(name=archive_path, mode=archive_mode)<EOL>tar.add(clone_path, arcname=root_url.split('<STR_LIT:/>').pop())<EOL>tar.close()<EOL>try:<EOL><INDENT>rmtree(clone_path)<EOL><DEDENT>except OSError as e:<EOL><INDENT>if e.errno != errno.ENOENT:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>
Archives a specific tag in a specific SVN repository.
:param root_url: This is the root url of the repo and should end in the
    repo name.
:param archive_path: Where the archive will be stored - Must end in a
    valid extension that matches the archive_mode type. Default requires
    'tar.gz'
:param tag: This is the tag you want to harvest, None=HEAD
:param archive_mode: See 'tarfile.open' modes default w:gz > tar.gz