Search in sources :

Example 1 with Settings

use of org.apache.maven.scm.providers.cvslib.settings.Settings in project maven-scm by apache.

the class AbstractCvsTagCommand method executeTagCommand.

/**
 * {@inheritDoc}
 */
public ScmResult executeTagCommand(ScmProviderRepository repo, ScmFileSet fileSet, String tag, ScmTagParameters scmTagParameters) throws ScmException {
    CvsScmProviderRepository repository = (CvsScmProviderRepository) repo;
    Commandline cl = CvsCommandUtils.getBaseCommand("tag", repository, fileSet, false);
    Settings settings = CvsUtil.getSettings();
    if (settings.isUseForceTag()) {
        cl.createArg().setValue("-F");
    }
    cl.createArg().setValue("-c");
    cl.createArg().setValue(tag);
    if (fileSet.getFileList() != null && !fileSet.getFileList().isEmpty()) {
        for (Iterator<File> it = fileSet.getFileList().iterator(); it.hasNext(); ) {
            File fileName = it.next();
            cl.createArg().setValue(fileName.toString());
        }
    }
    if (getLogger().isInfoEnabled()) {
        getLogger().info("Executing: " + cl);
        getLogger().info("Working directory: " + cl.getWorkingDirectory().getAbsolutePath());
    }
    return executeCvsCommand(cl);
}
Also used : CvsScmProviderRepository(org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository) Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File) Settings(org.apache.maven.scm.providers.cvslib.settings.Settings)

Example 2 with Settings

use of org.apache.maven.scm.providers.cvslib.settings.Settings in project maven-scm by apache.

the class CvsCommandUtils method getBaseCommand.

public static Commandline getBaseCommand(String commandName, CvsScmProviderRepository repo, ScmFileSet fileSet, String options, boolean addCvsRoot) {
    Settings settings = CvsUtil.getSettings();
    Commandline cl = new Commandline();
    cl.setExecutable("cvs");
    cl.setWorkingDirectory(fileSet.getBasedir().getAbsolutePath());
    if (Boolean.getBoolean("maven.scm.cvs.use_compression")) {
        cl.createArg().setValue("-z" + System.getProperty("maven.scm.cvs.compression_level", "3"));
    } else if (settings.getCompressionLevel() > 0) {
        cl.createArg().setValue("-z" + settings.getCompressionLevel());
    }
    if (!settings.isUseCvsrc()) {
        // don't use ~/.cvsrc
        cl.createArg().setValue("-f");
    }
    if (settings.isTraceCvsCommand()) {
        cl.createArg().setValue("-t");
    }
    if (!StringUtils.isEmpty(settings.getTemporaryFilesDirectory())) {
        File tempDir = new File(settings.getTemporaryFilesDirectory());
        if (!tempDir.exists()) {
            tempDir.mkdirs();
        }
        cl.createArg().setValue("-T");
        cl.createArg().setValue(tempDir.getAbsolutePath());
    }
    if (settings.getCvsVariables().size() > 0) {
        for (Enumeration<?> e = settings.getCvsVariables().propertyNames(); e.hasMoreElements(); ) {
            String key = (String) e.nextElement();
            String value = settings.getCvsVariables().getProperty(key);
            cl.createArg().setValue("-s");
            cl.createArg().setValue(key + "=" + value);
        }
    }
    if (addCvsRoot) {
        cl.createArg().setValue("-d");
        cl.createArg().setValue(repo.getCvsRoot());
    }
    cl.createArg().setLine(options);
    cl.createArg().setValue("-q");
    cl.createArg().setValue(commandName);
    return cl;
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) File(java.io.File) Settings(org.apache.maven.scm.providers.cvslib.settings.Settings)

Aggregations

File (java.io.File)2 Settings (org.apache.maven.scm.providers.cvslib.settings.Settings)2 Commandline (org.codehaus.plexus.util.cli.Commandline)2 CvsScmProviderRepository (org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository)1