<commit_before>fs       = require 'fs'
{ exec } = require 'child_process'

validateRepo = (repo, respond, next) ->

    if not /^[\w-_]+$/.test repo
        respond "That repository name is invalid."
        return
        
    fs.stat "/var/svn/#{repo}", (err, stats) ->
        if err
            respond "There isn't a repository with this name."
            return
        else
            next()

svnExport = (repo, respond) ->

    validate repo, ->
        
        options = "-q --no-auth-cache --username #{config.svn.username} --password #{config.svn.password}"
        exec "svn export #{options} svn://#{config.svn.url}/#{repo} #{config.svn.path}/#{repo}", (err, stdout, stderr) ->
            if err
                respond "Something bad happened while exporting 0_0"
            else
                respond "Exported to http://#{config.svn.public}/preview/#{repo}"
            return

svnLog = (repo, respond) ->

    validate repo, ->
        
        options = '-l 3 --no-auth-cache --username florinda --password <PASSWORD>'
        exec "svn log #{options} svn://localhost/#{repo}", (err, stdout, stderr) ->
            if err
                respond "Couldn't get the logs."
            else
                respond stdout
            return

brain.addPattern 'svn export',
    match: /^svn\sexport\s(.+)/i
    fn: (user, m, cb) -> svnExport m[1], cb

brain.addPattern 'svn log',
    match: [/^svn\slog\s(.+)/i
    fn: (user, m, cb) -> svnLog m[1], cb
<commit_msg>forgot a bracket<commit_after>fs       = require 'fs'
{ exec } = require 'child_process'

validateRepo = (repo, respond, next) ->

    if not /^[\w-_]+$/.test repo
        respond "That repository name is invalid."
        return
        
    fs.stat "/var/svn/#{repo}", (err, stats) ->
        if err
            respond "There isn't a repository with this name."
            return
        else
            next()

svnExport = (repo, respond) ->

    validate repo, ->
        
        options = "-q --no-auth-cache --username #{config.svn.username} --password #{config.svn.password}"
        exec "svn export #{options} svn://#{config.svn.url}/#{repo} #{config.svn.path}/#{repo}", (err, stdout, stderr) ->
            if err
                respond "Something bad happened while exporting 0_0"
            else
                respond "Exported to http://#{config.svn.public}/preview/#{repo}"
            return

svnLog = (repo, respond) ->

    validate repo, ->
        
        options = '-l 3 --no-auth-cache --username florinda --password <PASSWORD>'
        exec "svn log #{options} svn://localhost/#{repo}", (err, stdout, stderr) ->
            if err
                respond "Couldn't get the logs."
            else
                respond stdout
            return

brain.addPattern 'svn export',
    match: /^svn\sexport\s(.+)/i
    fn: (user, m, cb) -> svnExport m[1], cb

brain.addPattern 'svn log',
    match: /^svn\slog\s(.+)/i
    fn: (user, m, cb) -> svnLog m[1], cb

{'fraction_non_alphanumeric': 0.1530955585464334, 'fraction_numerical': 0.0033647375504710633, 'mean_word_length': 1.791549295774648, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3373794', 'n_tokens_mistral': 944, 'n_tokens_neox': 920, 'n_words': 262}