<commit_before>/*
 * CollabNet Subversion Edge
 * Copyright (C) 2010, CollabNet Inc. All rights reserved.
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.collabnet.svnedge.integration.command.impl

import org.apache.log4j.Logger
import com.collabnet.svnedge.domain.Repository 
import com.collabnet.svnedge.domain.Server 
import com.collabnet.svnedge.domain.integration.CtfServer 
import com.collabnet.svnedge.domain.integration.ReplicatedRepository 
import com.collabnet.svnedge.integration.command.AbstractRepositoryCommand 
import com.collabnet.svnedge.integration.command.ShortRunningCommand 

/**
 * This command uses svnsync to update the given repository
 */
public class RepoSyncCommand extends AbstractRepositoryCommand 
        implements ShortRunningCommand {

    private Logger log = Logger.getLogger(getClass())

    def constraints() {
        def repoName = getRepoName()
        log.debug("Acquiring the replica commands executor service...")
        def svn = getService("replicaCommandExecutorService")
        if (!this.params.repoName) {
            throw new IllegalArgumentException("The repo path must be provided")
        }
    }

    def execute() {
        def repoName = getRepoName()

        log.debug("Synchronizing repo: " + repoName)
        def commandLineService = getService("commandLineService")
        def syncRepoURI = commandLineService.createSvnFileURI(
                new File(Server.getServer().repoParentDir, repoName))
        def ctfServer = CtfServer.getServer()
        def username = ctfServer.ctfUsername
        def securityService = getService("securityService")
        def password = securityService.decrypt(ctfServer.ctfPassword)
        def repo = Repository.findByName(repoName)
        def replRepo = ReplicatedRepository.findByRepo(repo)
        execSvnSync(replRepo, System.currentTimeMillis(), username, password, 
            syncRepoURI)
    }

    def undo() {
        log.debug("Can't undo an svnsync")
    }
}
<commit_msg>[artf5441]: Capture SVN revision number in repository sync command <commit_after>/*
 * CollabNet Subversion Edge
 * Copyright (C) 2010, CollabNet Inc. All rights reserved.
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.collabnet.svnedge.integration.command.impl

import org.apache.log4j.Logger
import com.collabnet.svnedge.domain.Repository 
import com.collabnet.svnedge.domain.Server 
import com.collabnet.svnedge.domain.integration.CtfServer 
import com.collabnet.svnedge.domain.integration.ReplicatedRepository 
import com.collabnet.svnedge.integration.command.AbstractRepositoryCommand 
import com.collabnet.svnedge.integration.command.ShortRunningCommand 

/**
 * This command uses svnsync to update the given repository
 */
public class RepoSyncCommand extends AbstractRepositoryCommand 
        implements ShortRunningCommand {

    private Logger log = Logger.getLogger(getClass())

    def constraints() {
        def repoName = getRepoName()
        log.debug("Acquiring the replica commands executor service...")
        def svn = getService("replicaCommandExecutorService")
        if (!this.params.repoName) {
            throw new IllegalArgumentException("The repo path must be provided")
        }
    }

    def execute() {
        def repoName = getRepoName()

        log.debug("Synchronizing repo: " + repoName + " for revision " +
            this.params.revision)
        def commandLineService = getService("commandLineService")
        def syncRepoURI = commandLineService.createSvnFileURI(
                new File(Server.getServer().repoParentDir, repoName))
        def ctfServer = CtfServer.getServer()
        def username = ctfServer.ctfUsername
        def securityService = getService("securityService")
        def password = <PASSWORD>Service.decrypt(ctfServer.ctfPassword)
        def repo = Repository.findByName(repoName)
        def replRepo = ReplicatedRepository.findByRepo(repo)
        execSvnSync(replRepo, System.currentTimeMillis(), username, password, 
            syncRepoURI)
    }

    def undo() {
        log.debug("Can't undo an svnsync")
    }
}

{'fraction_non_alphanumeric': 0.0779970215934475, 'fraction_numerical': 0.0029784065524944155, 'mean_word_length': 3.466334164588529, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3406324', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1425, 'n_words': 452}