maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r374674 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs: ./ src/main/java/org/apache/maven/scm/provider/cvslib/command/ src/main/java/org/apache/maven/scm/provider/cvslib/util/ src/main/mdo/
Date Fri, 03 Feb 2006 14:21:11 GMT
Author: evenisse
Date: Fri Feb  3 06:21:03 2006
New Revision: 374674

URL: http://svn.apache.org/viewcvs?rev=374674&view=rev
Log:
[SCM-151][SCM-136] Allow to define global cvs options

Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/util/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/util/CvsUtil.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/mdo/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/mdo/cvs-settings.mdo
Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/pom.xml
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/command/CvsCommandUtils.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/pom.xml
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/pom.xml?rev=374674&r1=374673&r2=374674&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/pom.xml (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/pom.xml Fri Feb  3 06:21:03
2006
@@ -8,4 +8,26 @@
   <artifactId>maven-scm-provider-cvs</artifactId>
   <name>Maven SCM CVS Provider</name>
   <version>1.0-beta-3-SNAPSHOT</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.modello</groupId>
+        <artifactId>modello-maven-plugin</artifactId>
+        <version>1.0-alpha-6</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>java</goal>
+              <goal>xpp3-reader</goal>
+              <goal>xsd</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <version>1.0.0</version>
+          <model>src/main/mdo/cvs-settings.mdo</model>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/command/CvsCommandUtils.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/command/CvsCommandUtils.java?rev=374674&r1=374673&r2=374674&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/command/CvsCommandUtils.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/command/CvsCommandUtils.java
Fri Feb  3 06:21:03 2006
@@ -18,8 +18,14 @@
 
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository;
+import org.apache.maven.scm.provider.cvslib.util.CvsUtil;
+import org.apache.maven.scm.providers.cvslib.settings.Settings;
+import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 
+import java.io.File;
+import java.util.Enumeration;
+
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
@@ -38,18 +44,57 @@
     public static Commandline getBaseCommand( String commandName, CvsScmProviderRepository
repo, ScmFileSet fileSet,
                                               String options )
     {
+        Settings settings = CvsUtil.getSettings();
+
         Commandline cl = new Commandline();
 
         cl.setExecutable( "cvs" );
 
         cl.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() );
 
-        if ( !System.getProperty( "maven.scm.cvs.use_compression", "true" ).equals( "false"
) )
+        if ( settings.getCompressionLevel() > 0 )
+        {
+            cl.createArgument().setValue( "-z3" );
+        }
+        else if ( !System.getProperty( "maven.scm.cvs.use_compression", "true" ).equals(
"false" ) )
         {
             cl.createArgument().setValue( "-z3" );
         }
 
-        cl.createArgument().setValue( "-f" ); // don't use ~/.cvsrc
+        if ( !settings.isUseCvsrc() )
+        {
+            cl.createArgument().setValue( "-f" ); // don't use ~/.cvsrc
+        }
+
+        if ( settings.isTraceCvsCommand() )
+        {
+            cl.createArgument().setValue( "-t" );
+        }
+
+        if ( !StringUtils.isEmpty( settings.getTemporaryFilesDirectory() ) )
+        {
+            File tempDir = new File( settings.getTemporaryFilesDirectory() );
+
+            if ( !tempDir.exists() )
+            {
+                tempDir.mkdirs();
+            }
+
+            cl.createArgument().setValue( "-T" );
+
+            cl.createArgument().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.createArgument().setValue( "-s" );
+                cl.createArgument().setValue( key + "=" + value );
+            }
+        }
 
         cl.createArgument().setValue( "-d" );
 

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/util/CvsUtil.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/util/CvsUtil.java?rev=374674&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/util/CvsUtil.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/util/CvsUtil.java
Fri Feb  3 06:21:03 2006
@@ -0,0 +1,66 @@
+package org.apache.maven.scm.provider.cvslib.util;
+
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.apache.maven.scm.providers.cvslib.settings.Settings;
+import org.apache.maven.scm.providers.cvslib.settings.io.xpp3.CvsXpp3Reader;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class CvsUtil
+{
+    private CvsUtil()
+    {
+    }
+
+    public static Settings getSettings()
+    {
+        File scmUserDir = new File( System.getProperty( "user.dir" ), ".scm" );
+        File settingsFile = new File( scmUserDir, "cvs-settings.xml" );
+
+        if ( settingsFile.exists() )
+        {
+            CvsXpp3Reader reader = new CvsXpp3Reader();
+            try
+            {
+                return reader.read( new FileReader( settingsFile ) );
+            }
+            catch ( FileNotFoundException e )
+            {
+            }
+            catch ( IOException e )
+            {
+            }
+            catch ( XmlPullParserException e )
+            {
+                String message = settingsFile.getAbsolutePath() + " isn't well formed. SKIPPED."
+ e.getMessage();
+
+                System.out.println( message );
+            }
+        }
+
+        return new Settings();
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/util/CvsUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/util/CvsUtil.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/mdo/cvs-settings.mdo
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/mdo/cvs-settings.mdo?rev=374674&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/mdo/cvs-settings.mdo
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/mdo/cvs-settings.mdo
Fri Feb  3 06:21:03 2006
@@ -0,0 +1,67 @@
+<model>
+  <id>cvs</id>
+  <name>Cvs</name>
+  <description>CVS Provider Model.</description>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.apache.maven.scm.providers.cvslib.settings</value>
+    </default>
+  </defaults>
+
+  <classes>
+    <class rootElement="true" xml.tagName="cvs-settings">
+      <name>Settings</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field>
+          <name>useCvsrc</name>
+          <version>1.0.0+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+          <description><![CDATA[
+             Do you want to use .cvsrc file?
+          ]]></description>
+        </field>
+        <field>
+          <name>compressionLevel</name>
+          <version>1.0.0+</version>
+          <type>int</type>
+          <defaultValue>3</defaultValue>
+          <description><![CDATA[
+             Sets the compression level on communications with the server? If you don't want
to use compression, set it to 0.
+          ]]></description>
+        </field>
+        <field>
+          <name>traceCvsCommand</name>
+          <version>1.0.0+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+          <description><![CDATA[
+             Traces the execution of a CVS command.
+          ]]></description>
+        </field>
+        <field>
+          <name>temporaryFilesDirectory</name>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <description><![CDATA[
+             Stores any temporary files in DIR instead of wherever CVS normally puts them
(specifically, this overrides the value of the $TMPDIR environment variable, if any exists).
It should be an absolute path.
+          ]]></description>
+        </field>
+        <field>
+          <name>cvsVariables</name>
+          <version>1.0.0+</version>
+          <description><![CDATA[
+             This sets internal CVS variables
+          ]]></description>
+          <type>Properties</type>
+          <association xml.mapStyle="inline">
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>



Mime
View raw message