maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r373905 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/maven/ src/main/java/org/apache/maven/scm/ src/main/java/org/ap...
Date Tue, 31 Jan 2006 20:34:33 GMT
Author: evenisse
Date: Tue Jan 31 12:34:20 2006
New Revision: 373905

URL: http://svn.apache.org/viewcvs?rev=373905&view=rev
Log:
Add a basic VSS Provider with only changelog command.

Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/pom.xml   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssParameterContext.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssChangeLogConsumer.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommand.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/plexus/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/plexus/components.xml   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/VssScmProviderTest.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 31 12:34:20 2006
@@ -0,0 +1,4 @@
+maven-scm-provider-vss.iml
+maven-scm-provider-vss.ipr
+maven-scm-provider-vss.iws
+target

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/pom.xml
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/pom.xml?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/pom.xml (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/pom.xml Tue Jan 31 12:34:20 2006
@@ -0,0 +1,11 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+	<artifactId>maven-scm-providers</artifactId>
+	<groupId>org.apache.maven.scm</groupId>
+	<version>1.0-beta-3-SNAPSHOT</version>
+  </parent>
+  <artifactId>maven-scm-provider-vss</artifactId>
+  <version>1.0-beta-3-SNAPSHOT</version>
+  <name>Maven SCM Visual Source Safe Provider</name>
+</project>

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java Tue Jan 31 12:34:20 2006
@@ -0,0 +1,222 @@
+package org.apache.maven.scm.provider.vss;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.scm.CommandParameters;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
+import org.apache.maven.scm.provider.AbstractScmProvider;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.vss.commands.changelog.VssHistoryCommand;
+import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author <a href="mailto:george@neogrid.com.br">George Gastaldi</a>
+ * @version $Id$
+ *          <p/>
+ *          http://msdn.microsoft.com/library/default.asp?url=/library/en-us/guides/html/vstskuse_command_line_commands_and_options.asp
+ */
+public class VssScmProvider
+    extends AbstractScmProvider
+{
+
+    public static final String VSS_URL_FORMAT = "[username[|password]@]vssdir|projectPath";
+
+    // ----------------------------------------------------------------------
+    // ScmProvider Implementation
+    // ----------------------------------------------------------------------
+
+    public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter )
+        throws ScmRepositoryException
+    {
+        String user = null;
+        String password = null;
+        String vssDir;
+        String project;
+
+        int index = scmSpecificUrl.indexOf( '@' );
+
+        String rest = scmSpecificUrl;
+
+        if ( index != -1 )
+        {
+            String userAndPassword = scmSpecificUrl.substring( 0, index );
+
+            rest = scmSpecificUrl.substring( index + 1 );
+
+            index = userAndPassword.indexOf( delimiter );
+
+            if ( index != -1 )
+            {
+                user = userAndPassword.substring( 0, index );
+
+                password = userAndPassword.substring( index + 1 );
+            }
+            else
+            {
+                user = userAndPassword;
+            }
+        }
+        String[] tokens = StringUtils.split( rest, String.valueOf( delimiter ) );
+
+        if ( tokens.length < 2 )
+        {
+            throw new ScmRepositoryException( "Invalid SCM URL: The url has to be on the form: " + VSS_URL_FORMAT );
+        }
+        else
+        {
+            vssDir = tokens[0];
+
+            project = tokens[1];
+        }
+
+        return new VssScmProviderRepository( user, password, vssDir, project );
+    }
+
+    public String getScmType()
+    {
+        return "vss";
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#add(org.apache.maven.scm.repository.ScmRepository,
+     *      org.apache.maven.scm.ScmFileSet,
+     *      org.apache.maven.scm.CommandParameters)
+     */
+/*
+    public AddScmResult add( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
+        throws ScmException
+    {
+        // TODO: Check whether the CREATE command must be called
+        VssAddCommand command = new VssAddCommand();
+        command.setLogger( getLogger() );
+
+        return (AddScmResult) command.execute( repository
+            .getProviderRepository(), fileSet, parameters );
+    }
+*/
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#checkin(org.apache.maven.scm.repository.ScmRepository,
+     *      org.apache.maven.scm.ScmFileSet,
+     *      org.apache.maven.scm.CommandParameters)
+     */
+/*
+    public CheckInScmResult checkin( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
+        throws ScmException
+    {
+        VssCheckInCommand command = new VssCheckInCommand();
+
+        command.setLogger( getLogger() );
+
+        return (CheckInScmResult) command.execute( repository
+            .getProviderRepository(), fileSet, parameters );
+    }
+*/
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#checkout(org.apache.maven.scm.repository.ScmRepository,
+     *      org.apache.maven.scm.ScmFileSet,
+     *      org.apache.maven.scm.CommandParameters)
+     */
+/*
+    public CheckOutScmResult checkout( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
+        throws ScmException
+    {
+        VssCheckOutCommand command = new VssCheckOutCommand();
+
+        command.setLogger( getLogger() );
+
+        return (CheckOutScmResult) command.execute( repository
+            .getProviderRepository(), fileSet, parameters );
+    }
+*/
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#changelog(org.apache.maven.scm.repository.ScmRepository,
+     *      org.apache.maven.scm.ScmFileSet,
+     *      org.apache.maven.scm.CommandParameters)
+     */
+    public ChangeLogScmResult changelog( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
+        throws ScmException
+    {
+        VssHistoryCommand command = new VssHistoryCommand();
+
+        command.setLogger( getLogger() );
+
+        return (ChangeLogScmResult) command.execute( repository
+            .getProviderRepository(), fileSet, parameters );
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#tag(org.apache.maven.scm.repository.ScmRepository,
+     *      org.apache.maven.scm.ScmFileSet,
+     *      org.apache.maven.scm.CommandParameters)
+     */
+/*
+    public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
+        throws ScmException
+    {
+        VssLabelCommand command = new VssLabelCommand();
+
+        command.setLogger( getLogger() );
+
+        return (TagScmResult) command.execute( repository
+            .getProviderRepository(), fileSet, parameters );
+    }
+*/
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#update(org.apache.maven.scm.repository.ScmRepository,
+     *      org.apache.maven.scm.ScmFileSet,
+     *      org.apache.maven.scm.CommandParameters)
+     */
+/*
+    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
+        throws ScmException
+    {
+        VssGetCommand command = new VssGetCommand();
+
+        command.setLogger( getLogger() );
+
+        return (UpdateScmResult) command.execute( repository
+            .getProviderRepository(), fileSet, parameters );
+    }
+*/
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#remove(org.apache.maven.scm.repository.ScmRepository,
+     *      org.apache.maven.scm.ScmFileSet,
+     *      org.apache.maven.scm.CommandParameters)
+     */
+/*
+    protected RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
+        throws ScmException
+    {
+        VssRemoveCommand command = new VssRemoveCommand();
+
+        command.setLogger( getLogger() );
+
+        return (RemoveScmResult) command.execute( repository
+            .getProviderRepository(), fileSet, parameters );
+    }
+*/
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java Tue Jan 31 12:34:20 2006
@@ -0,0 +1,82 @@
+package org.apache.maven.scm.provider.vss.commands;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.log.ScmLogger;
+import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.io.File;
+
+public class VssCommandLineUtils
+    implements VssConstants
+{
+    public static void addFiles( Commandline cl, File[] files )
+    {
+        for ( int i = 0; i < files.length; i++ )
+        {
+            cl.createArgument().setValue( files[i].getPath().replace( '\\', '/' ) );
+        }
+    }
+
+    public static Commandline getBaseSvnCommandLine( File workingDirectory, String cmd,
+                                                     VssScmProviderRepository repository )
+    {
+        Commandline cl = new Commandline();
+
+        cl.setExecutable( VssConstants.SS_EXE );
+
+        cl.setWorkingDirectory( workingDirectory.getAbsolutePath() );
+
+        if ( !StringUtils.isEmpty( repository.getUser() ) )
+        {
+            cl.createArgument().setValue( "-Y" );
+
+            StringBuffer sb = new StringBuffer( repository.getUser() );
+            if ( !StringUtils.isEmpty( repository.getPassword() ) )
+            {
+                sb.append( "," ).append( repository.getPassword() );
+            }
+            cl.createArgument().setValue( sb.toString() );
+        }
+
+        return cl;
+    }
+
+    public static int executeCommandline( Commandline cl, StreamConsumer consumer,
+                                          CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger )
+        throws ScmException
+    {
+        try
+        {
+            logger.info( "Executing: " + cl );
+            logger.info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
+
+            return CommandLineUtils.executeCommandLine( cl, consumer, stderr );
+        }
+        catch ( CommandLineException ex )
+        {
+            throw new ScmException( "Error while executing command.", ex );
+        }
+    }
+
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java Tue Jan 31 12:34:20 2006
@@ -0,0 +1,179 @@
+package org.apache.maven.scm.provider.vss.commands;
+
+/*
+ * 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.
+ */
+
+/**
+ * Holds all the constants for the VSS tasks.
+ */
+public interface VssConstants
+{
+    /**
+     * Constant for the thing to execute
+     */
+    String SS_EXE = "ss";
+
+    /**
+     * Dollar Sigh to prefix the project path
+     */
+    String PROJECT_PREFIX = "$";
+
+    /**
+     * The 'CP' command
+     */
+    String COMMAND_CP = "CP";
+
+    /**
+     * The 'Add' command
+     */
+    String COMMAND_ADD = "Add";
+
+    /**
+     * The 'Get' command
+     */
+    String COMMAND_GET = "Get";
+
+    /**
+     * The 'Checkout' command
+     */
+    String COMMAND_CHECKOUT = "Checkout";
+
+    /**
+     * The 'Checkin' command
+     */
+    String COMMAND_CHECKIN = "Checkin";
+
+    /**
+     * The 'Label' command
+     */
+    String COMMAND_LABEL = "Label";
+
+    /**
+     * The 'History' command
+     */
+    String COMMAND_HISTORY = "History";
+
+    /**
+     * The 'Create' command
+     */
+    String COMMAND_CREATE = "Create";
+
+    /**
+     * The brief style flag
+     */
+    String STYLE_BRIEF = "brief";
+
+    /**
+     * The codediff style flag
+     */
+    String STYLE_CODEDIFF = "codediff";
+
+    /**
+     * The nofile style flag
+     */
+    String STYLE_NOFILE = "nofile";
+
+    /**
+     * The default style flag
+     */
+    String STYLE_DEFAULT = "default";
+
+    /**
+     * The text for  current (default) timestamp
+     */
+    String TIME_CURRENT = "current";
+
+    /**
+     * The text for  modified timestamp
+     */
+    String TIME_MODIFIED = "modified";
+
+    /**
+     * The text for  updated timestamp
+     */
+    String TIME_UPDATED = "updated";
+
+    /**
+     * The text for replacing writable files
+     */
+    String WRITABLE_REPLACE = "replace";
+
+    /**
+     * The text for skiping writable files
+     */
+    String WRITABLE_SKIP = "skip";
+
+    /**
+     * The text for failing on writable files
+     */
+    String WRITABLE_FAIL = "fail";
+
+    String FLAG_LOGIN = "-Y";
+
+    String FLAG_OVERRIDE_WORKING_DIR = "-GL";
+
+    String FLAG_AUTORESPONSE_DEF = "-I-";
+
+    String FLAG_AUTORESPONSE_YES = "-I-Y";
+
+    String FLAG_AUTORESPONSE_NO = "-I-N";
+
+    String FLAG_RECURSION = "-R";
+
+    String FLAG_VERSION = "-V";
+
+    String FLAG_VERSION_DATE = "-Vd";
+
+    String FLAG_VERSION_LABEL = "-VL";
+
+    String FLAG_WRITABLE = "-W";
+
+    String VALUE_NO = "-N";
+
+    String VALUE_YES = "-Y";
+
+    String FLAG_QUIET = "-O-";
+
+    String FLAG_COMMENT = "-C";
+
+    String FLAG_LABEL = "-L";
+
+    String VALUE_FROMDATE = "~d";
+
+    String VALUE_FROMLABEL = "~L";
+
+    String FLAG_OUTPUT = "-O";
+
+    String FLAG_USER = "-U";
+
+    String FLAG_NO_FILE = "-F-";
+
+    String FLAG_BRIEF = "-B";
+
+    String FLAG_CODEDIFF = "-D";
+
+    String FLAG_FILETIME_DEF = "-GTC";
+
+    String FLAG_FILETIME_MODIFIED = "-GTM";
+
+    String FLAG_FILETIME_UPDATED = "-GTU";
+
+    String FLAG_REPLACE_WRITABLE = "-GWR";
+
+    String FLAG_SKIP_WRITABLE = "-GWS";
+
+    String FLAG_NO_GET = "-G-";
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssParameterContext.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssParameterContext.java?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssParameterContext.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssParameterContext.java Tue Jan 31 12:34:20 2006
@@ -0,0 +1,506 @@
+package org.apache.maven.scm.provider.vss.commands;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository;
+
+import java.io.File;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+
+public class VssParameterContext
+    implements VssConstants
+{
+
+    private String vssPath = null;
+
+    private String autoResponse;
+
+    private String ssDir;
+
+    private String vssLogin;
+
+    private String comment;
+
+    private String user;
+
+    private String fromLabel;
+
+    private String toLabel;
+
+    private boolean quiet;
+
+    private boolean recursive;
+
+    private boolean writable;
+
+    private String label;
+
+    private String style;
+
+    private String version;
+
+    private String date;
+
+    private String localPath;
+
+    private String timestamp;
+
+    /**
+     * Behaviour for writable files
+     */
+    private String writableFiles = null;
+
+    /**
+     * From date
+     */
+    private String fromDate = null;
+
+    /**
+     * To date
+     */
+    private String toDate = null;
+
+    /**
+     * Number of days offset for History
+     */
+    private int numDays = Integer.MIN_VALUE;
+
+    /**
+     * Get local copy for checkout defaults to true
+     */
+    private boolean getLocalCopy = true;
+
+    /**
+     * Date format for History
+     */
+    private DateFormat dateFormat = DateFormat
+        .getDateInstance( DateFormat.SHORT );
+
+    private String outputFileName;
+
+    public static VssParameterContext getInstance( Object obj )
+    {
+        return new VssParameterContext( (VssScmProviderRepository) obj );
+    }
+
+    public VssParameterContext( VssScmProviderRepository repo )
+    {
+        autoResponse = System.getProperty( "maven.scm.autoResponse" );
+        this.ssDir = repo.getVssdir();
+        this.user = repo.getUser();
+//		this.vssLogin = this.user + (repos.getPassword() == null ? "" : ","+repos.getPassword());
+    }
+
+    /**
+     * Builds and returns the -G- flag if required.
+     *
+     * @return An empty string if get local copy is true.
+     */
+    public String getGetLocalCopy()
+    {
+        return ( !getLocalCopy ) ? FLAG_NO_GET : "";
+    }
+
+    /**
+     * Calculate the start date for version comparison.
+     * <p/>
+     * Calculate the date numDay days earlier than startdate.
+     *
+     * @param startDate The start date.
+     * @param daysToAdd The number of days to add.
+     * @return The calculated date.
+     * @throws ParseException
+     */
+    private String calcDate( String startDate, int daysToAdd )
+        throws ParseException
+    {
+        Date currentDate = new Date();
+        Calendar calendar = new GregorianCalendar();
+        currentDate = dateFormat.parse( startDate );
+        calendar.setTime( currentDate );
+        calendar.add( Calendar.DATE, daysToAdd );
+        return dateFormat.format( calendar.getTime() );
+    }
+
+    /**
+     * Gets the value set for the FileTimeStamp. if it equals "current" then we
+     * return -GTC if it equals "modified" then we return -GTM if it equals
+     * "updated" then we return -GTU otherwise we return -GTC
+     *
+     * @return The default file time flag, if not set.
+     */
+    public String getFileTimeStamp()
+    {
+        if ( timestamp == null )
+        {
+            return "";
+        }
+        return timestamp;
+    }
+
+    /**
+     * Gets the localpath string. "-GLc:\source"
+     * <p/>
+     * The localpath is created if it didn't exist.
+     *
+     * @return An empty string if localpath is not set.
+     */
+    public String getLocalpath()
+        throws ScmException
+    {
+        String lclPath = ""; // set to empty str if no local path return
+        if ( localPath != null )
+        {
+            // make sure m_LocalDir exists, create it if it doesn't
+            File dir = new File( localPath );
+            if ( !dir.exists() )
+            {
+                boolean done = dir.mkdirs();
+                if ( !done )
+                {
+                    String msg = "Directory " + localPath + " creation was not " + "successful for an unknown reason";
+                    throw new ScmException( msg );
+                }
+//				getLogger().info("Created dir: " + dir.getAbsolutePath());
+            }
+            lclPath = FLAG_OVERRIDE_WORKING_DIR + localPath;
+        }
+        return lclPath;
+    }
+
+    /**
+     * Gets the label string. "-Lbuild1" Max label length is 32 chars
+     *
+     * @return An empty string if label is not set.
+     */
+    public String getLabel()
+    {
+        String shortLabel = "";
+        if ( label != null && label.length() > 0 )
+        {
+            shortLabel = FLAG_LABEL + getShortLabel();
+        }
+        return shortLabel;
+    }
+
+    /**
+     * Gets the version string. Returns the first specified of version "-V1.0",
+     * date "-Vd01.01.01", label "-Vlbuild1".
+     *
+     * @return An empty string if a version, date and label are not set.
+     */
+    public String getVersionDateLabel()
+    {
+        String versionDateLabel = "";
+        if ( version != null )
+        {
+            versionDateLabel = FLAG_VERSION + version;
+        }
+        else if ( date != null )
+        {
+            versionDateLabel = FLAG_VERSION_DATE + date;
+        }
+        else
+        {
+            // Use getShortLabel() so labels longer then 30 char are truncated
+            // and the user is warned
+            String shortLabel = getShortLabel();
+            if ( shortLabel != null && !shortLabel.equals( "" ) )
+            {
+                versionDateLabel = FLAG_VERSION_LABEL + shortLabel;
+            }
+        }
+        return versionDateLabel;
+    }
+
+    /**
+     * Gets the version string.
+     *
+     * @return An empty string if a version is not set.
+     */
+    public String getVersion()
+    {
+        return version != null ? FLAG_VERSION + version : "";
+    }
+
+    /**
+     * Return at most the 30 first chars of the label, logging a warning message
+     * about the truncation
+     *
+     * @return at most the 30 first chars of the label
+     */
+    private String getShortLabel()
+    {
+        String shortLabel;
+        if ( label != null && label.length() > 31 )
+        {
+            shortLabel = this.label.substring( 0, 30 );
+//			getLogger().warn(
+//					"Label is longer than 31 characters, truncated to: "
+//							+ shortLabel);
+        }
+        else
+        {
+            shortLabel = label;
+        }
+        return shortLabel;
+    }
+
+    /**
+     * Gets the style string. "-Lbuild1"
+     *
+     * @return An empty string if label is not set.
+     */
+    public String getStyle()
+    {
+        return style != null ? style : "";
+    }
+
+    /**
+     * Gets the recursive string. "-R"
+     *
+     * @return An empty string if recursive is not set or is false.
+     */
+    public String getRecursive()
+    {
+        return recursive ? FLAG_RECURSION : "";
+    }
+
+    /**
+     * Gets the writable string. "-W"
+     *
+     * @return An empty string if writable is not set or is false.
+     */
+    public String getWritable()
+    {
+        return writable ? FLAG_WRITABLE : "";
+    }
+
+    /**
+     * Gets the quiet string. -O-
+     *
+     * @return An empty string if quiet is not set or is false.
+     */
+    public String getQuiet()
+    {
+        return quiet ? FLAG_QUIET : "";
+    }
+
+    public String getVersionLabel()
+    {
+        if ( fromLabel == null && toLabel == null )
+        {
+            return "";
+        }
+        if ( fromLabel != null && toLabel != null )
+        {
+            if ( fromLabel.length() > 31 )
+            {
+                fromLabel = fromLabel.substring( 0, 30 );
+//				getLogger().warn(
+//						"FromLabel is longer than 31 characters, truncated to: "
+//								+ fromLabel);
+            }
+            if ( toLabel.length() > 31 )
+            {
+                toLabel = toLabel.substring( 0, 30 );
+//				getLogger().warn(
+//						"ToLabel is longer than 31 characters, truncated to: "
+//								+ toLabel);
+            }
+            return FLAG_VERSION_LABEL + toLabel + VALUE_FROMLABEL + fromLabel;
+        }
+        else if ( fromLabel != null )
+        {
+            if ( fromLabel.length() > 31 )
+            {
+                fromLabel = fromLabel.substring( 0, 30 );
+//				getLogger().warn(
+//						"FromLabel is longer than 31 characters, truncated to: "
+//								+ fromLabel);
+            }
+            return FLAG_VERSION + VALUE_FROMLABEL + fromLabel;
+        }
+        else
+        {
+            if ( toLabel.length() > 31 )
+            {
+                toLabel = toLabel.substring( 0, 30 );
+//				getLogger().warn(
+//						"ToLabel is longer than 31 characters, truncated to: "
+//								+ toLabel);
+            }
+            return FLAG_VERSION_LABEL + toLabel;
+        }
+    }
+
+    /**
+     * Gets the user string. "-Uusername"
+     *
+     * @return An empty string if user is not set.
+     */
+    public String getUser()
+    {
+        return user != null ? FLAG_USER + user : "";
+    }
+
+    /**
+     * Gets the comment string. "-Ccomment text"
+     *
+     * @return A comment of "-" if comment is not set.
+     */
+    public String getComment()
+    {
+        return comment != null ? FLAG_COMMENT + comment : FLAG_COMMENT + "-";
+    }
+
+    /**
+     * Gets the login string. This can be user and password, "-Yuser,password"
+     * or just user "-Yuser".
+     *
+     * @return An empty string if login is not set.
+     */
+    public String getLogin()
+    {
+        return vssLogin != null ? ( FLAG_LOGIN + vssLogin ) : "";
+    }
+
+    /**
+     * Gets the auto response string. This can be Y "-I-Y" or N "-I-N".
+     *
+     * @return The default value "-I-" if autoresponse is not set.
+     */
+    public String getAutoresponse()
+    {
+        if ( autoResponse == null )
+        {
+            return FLAG_AUTORESPONSE_DEF;
+        }
+        else if ( autoResponse.equalsIgnoreCase( "Y" ) )
+        {
+            return FLAG_AUTORESPONSE_YES;
+        }
+        else if ( autoResponse.equalsIgnoreCase( "N" ) )
+        {
+            return FLAG_AUTORESPONSE_NO;
+        }
+        else
+        {
+            return FLAG_AUTORESPONSE_DEF;
+        }
+    }
+
+    /**
+     * Gets the sscommand string. "ss" or "c:\path\to\ss"
+     *
+     * @return The path to ss.exe or just ss if sscommand is not set.
+     */
+    public String getSSCommand()
+    {
+        if ( ssDir == null )
+        {
+            return SS_EXE;
+        }
+        return ssDir.endsWith( File.separator ) ? ssDir + SS_EXE : ssDir + File.separator + SS_EXE;
+    }
+
+    public String getVssPath()
+    {
+        return vssPath;
+    }
+
+
+    /**
+     * Gets the Version date string.
+     *
+     * @return An empty string if neither Todate or from date are set.
+     * @throws ScmException
+     */
+    public String getVersionDate()
+        throws ScmException
+    {
+        if ( fromDate == null && toDate == null && numDays == Integer.MIN_VALUE )
+        {
+            return "";
+        }
+        if ( fromDate != null && toDate != null )
+        {
+            return FLAG_VERSION_DATE + toDate + VALUE_FROMDATE + fromDate;
+        }
+        else if ( toDate != null && numDays != Integer.MIN_VALUE )
+        {
+            try
+            {
+                return FLAG_VERSION_DATE + toDate + VALUE_FROMDATE + calcDate( toDate, numDays );
+            }
+            catch ( ParseException ex )
+            {
+                String msg = "Error parsing date: " + toDate;
+                throw new ScmException( msg );
+            }
+        }
+        else if ( fromDate != null && numDays != Integer.MIN_VALUE )
+        {
+            try
+            {
+                return FLAG_VERSION_DATE + calcDate( fromDate, numDays ) + VALUE_FROMDATE + fromDate;
+            }
+            catch ( ParseException ex )
+            {
+                String msg = "Error parsing date: " + fromDate;
+                throw new ScmException( msg );
+            }
+        }
+        else
+        {
+            return fromDate != null ? FLAG_VERSION + VALUE_FROMDATE + fromDate : FLAG_VERSION_DATE + toDate;
+        }
+    }
+
+    /**
+     * Gets the output file string. "-Ooutput.file"
+     *
+     * @return An empty string if user is not set.
+     */
+    public String getOutput()
+    {
+        return outputFileName != null ? FLAG_OUTPUT + outputFileName : "";
+    }
+
+    /**
+     * Gets the value to determine the behaviour when encountering writable
+     * files.
+     *
+     * @return An empty String, if not set.
+     */
+    public String getWritableFiles()
+    {
+        // FIXME: Fix this
+        if ( writableFiles == null )
+        {
+            return "";
+        }
+        return writableFiles;
+    }
+
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssParameterContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssParameterContext.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssChangeLogConsumer.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssChangeLogConsumer.java?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssChangeLogConsumer.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssChangeLogConsumer.java Tue Jan 31 12:34:20 2006
@@ -0,0 +1,329 @@
+package org.apache.maven.scm.provider.vss.commands.changelog;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.scm.ChangeFile;
+import org.apache.maven.scm.ChangeSet;
+import org.apache.maven.scm.log.ScmLogger;
+import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Vector;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class VssChangeLogConsumer
+    implements StreamConsumer
+{
+    /**
+     * Custom date/time formatter. Rounds ChangeLogEntry times to the nearest
+     * minute.
+     */
+    private static final SimpleDateFormat ENTRY_KEY_TIMESTAMP_FORMAT = new SimpleDateFormat( "yyyyMMddHHmm" );
+
+    // state machine constants for reading Starteam output
+
+    /**
+     * expecting file information
+     */
+    private static final int GET_FILE = 1;
+
+    /**
+     * expecting file path information
+     */
+    private static final int GET_FILE_PATH = 2;
+
+    /**
+     * expecting date
+     */
+    private static final int GET_AUTHOR = 3;
+
+    /**
+     * expecting comments
+     */
+    private static final int GET_COMMENT = 4;
+
+    /**
+     * expecting revision
+     */
+    private static final int GET_REVISION = 5;
+
+    /**
+     * unknown vss history line status
+     */
+    private static final int GET_UNKNOWN = 6;
+
+    /**
+     * Marks start of file data
+     */
+    private static final String START_FILE = "*****  ";
+
+    /**
+     * Marks start of file data
+     */
+    private static String START_FILE_PATH = "$/";
+
+    /**
+     * Marks start of revision
+     */
+    private static final String START_REVISION = "Version";
+
+    /**
+     * Marks author data
+     */
+    private static final String START_AUTHOR = "User: ";
+
+    /**
+     * Marks comment data
+     */
+    private static final String START_COMMENT = "Comment: ";
+
+    /**
+     * rcs entries, in reverse (date, time, author, comment) order
+     */
+    private Map entries = new TreeMap( Collections.reverseOrder() );
+
+    ChangeFile currentFile;
+
+    ChangeSet currentChangeSet;
+
+    /**
+     * last status of the parser
+     */
+    private int lastStatus = GET_FILE;
+
+    VssScmProviderRepository repo;
+
+    ScmLogger logger;
+
+    public VssChangeLogConsumer( VssScmProviderRepository repo, ScmLogger logger )
+    {
+        this.repo = repo;
+        this.logger = logger;
+    }
+
+    public List getModifications()
+    {
+        return new ArrayList( entries.values() );
+    }
+
+    public void consumeLine( String line )
+    {
+        switch ( getLineStatus( line ) )
+        {
+            case GET_FILE:
+                processGetFile( line );
+                break;
+            case GET_REVISION:
+                processGetRevision( line );
+                break;
+            case GET_AUTHOR:
+                processGetAuthor( line );
+                break;
+            case GET_FILE_PATH:
+                processGetFilePath( line );
+                break;
+            case GET_COMMENT:
+                processGetComment( line );
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * Process the current input line in the Get Comment state.
+     *
+     * @param line a line of text from the VSS log output
+     */
+    private void processGetComment( String line )
+    {
+        String[] commentLine = line.split( ":" );
+        if ( commentLine.length == 2 )
+        {
+            currentChangeSet.setComment( commentLine[1] );
+        }
+        //Comment suite on a new line
+        else
+        {
+            String comment = currentChangeSet.getComment();
+            comment = comment + " " + line;
+            currentChangeSet.setComment( comment );
+        }
+    }
+
+    /**
+     * Process the current input line in the Get Author state.
+     *
+     * @param line a line of text from the VSS log output
+     */
+    private void processGetAuthor( String line )
+    {
+        String[] result = line.split( "\\s" );
+        Vector vector = new Vector();
+        for ( int i = 0; i < result.length; i++ )
+        {
+            if ( !result[i].equals( "" ) )
+            {
+                vector.add( result[i] );
+            }
+        }
+        currentChangeSet.setAuthor( (String) vector.get( 1 ) );
+        currentChangeSet.setDate( parseDate( vector.get( 3 ) + " " + vector.get( 5 ) ) );
+    }
+
+    /**
+     * Process the current input line in the Get File state.
+     *
+     * @param line a line of text from the VSS log output
+     */
+    private void processGetFile( String line )
+    {
+        currentChangeSet = ( new ChangeSet() );
+        String[] fileLine = line.split( " " );
+        currentFile = new ChangeFile( fileLine[2] );
+    }
+
+    /**
+     * Process the current input line in the Get File Path state.
+     *
+     * @param line a line of text from the VSS log output
+     */
+    private void processGetFilePath( String line )
+    {
+        if ( currentFile != null )
+        {
+            String fileName = currentFile.getName();
+
+            String path = line.substring( line.indexOf( "$" ), line.length() );
+            String longPath = path.substring( repo.getProject()
+                .length() + 1, path.length() ) + "/" + fileName;
+            currentFile.setName( longPath );
+            addEntry( currentChangeSet, currentFile );
+        }
+    }
+
+    /**
+     * Process the current input line in the Get Revision state.
+     *
+     * @param line a line of text from the VSS log output
+     */
+    private void processGetRevision( String line )
+    {
+        String[] revisionLine = line.split( " " );
+        currentFile.setRevision( revisionLine[1] );
+    }
+
+    /**
+     * Identify the status of a vss history line
+     *
+     * @param line The line to process
+     * @return status
+     */
+    private int getLineStatus( String line )
+    {
+        int argument = GET_UNKNOWN;
+        if ( line.startsWith( START_FILE ) )
+        {
+            argument = GET_FILE;
+        }
+        else if ( line.startsWith( START_REVISION ) )
+        {
+            argument = GET_REVISION;
+        }
+        else if ( line.startsWith( START_AUTHOR ) )
+        {
+            argument = GET_AUTHOR;
+        }
+        else if ( line.indexOf( START_FILE_PATH ) != -1 )
+        {
+            argument = GET_FILE_PATH;
+        }
+        else if ( line.startsWith( START_COMMENT ) )
+        {
+            argument = GET_COMMENT;
+        }
+        else if ( lastStatus == GET_COMMENT )
+        {
+            //Comment suite on a new line
+            argument = lastStatus;
+        }
+        lastStatus = argument;
+
+        return argument;
+    }
+
+    /**
+     * Add a change log entry to the list (if it's not already there) with the
+     * given file.
+     *
+     * @param entry a {@link ChangeSet}to be added to the list if another
+     *              with the same key doesn't exist already. If the entry's author
+     *              is null, the entry wont be added
+     * @param file  a {@link ChangeFile}to be added to the entry
+     */
+    private void addEntry( ChangeSet entry, ChangeFile file )
+    {
+        // do not add if entry is not populated
+        if ( entry.getAuthor() == null )
+        {
+            return;
+        }
+
+        String key = ENTRY_KEY_TIMESTAMP_FORMAT.format( entry.getDate() ) + entry.getAuthor() + entry.getComment();
+
+        if ( !entries.containsKey( key ) )
+        {
+            entry.addFile( file );
+            entries.put( key, entry );
+        }
+        else
+        {
+            ChangeSet existingEntry = (ChangeSet) entries.get( key );
+            existingEntry.addFile( file );
+        }
+    }
+
+    /**
+     * Converts the date timestamp from the svn output into a date object.
+     *
+     * @return A date representing the timestamp of the log entry.
+     */
+    private Date parseDate( String dateString )
+    {
+        try
+        {
+            SimpleDateFormat format = new SimpleDateFormat( "dd.MM.yy HH:mm" );
+            return format.parse( dateString );
+        }
+        catch ( ParseException e )
+        {
+            logger.error( "ParseException Caught", e );
+            return null;
+        }
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssChangeLogConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssChangeLogConsumer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommand.java?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommand.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommand.java Tue Jan 31 12:34:20 2006
@@ -0,0 +1,105 @@
+package org.apache.maven.scm.provider.vss.commands.changelog;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.command.changelog.AbstractChangeLogCommand;
+import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils;
+import org.apache.maven.scm.provider.vss.commands.VssConstants;
+import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+public class VssHistoryCommand
+    extends AbstractChangeLogCommand
+{
+    protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repository, ScmFileSet fileSet,
+                                                          Date startDate, Date endDate, int numDays, String branch )
+        throws ScmException
+    {
+        VssScmProviderRepository repo = (VssScmProviderRepository) repository;
+
+        Commandline cl = buildCmdLine( repo, fileSet, startDate, endDate, numDays );
+
+        VssChangeLogConsumer consumer = new VssChangeLogConsumer( repo, getLogger() );
+
+        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+        int exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
+
+        if ( exitCode != 0 )
+        {
+            return new ChangeLogScmResult( cl.toString(), "The vss command failed.", stderr.getOutput(), false );
+        }
+
+        return new ChangeLogScmResult( cl.toString(), consumer.getModifications() );
+    }
+
+    public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet, Date startDate, Date endDate,
+                                     int numDays )
+        throws ScmException
+    {
+        Commandline command = new Commandline();
+
+        command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() );
+
+        try
+        {
+            command.addSystemEnvironment();
+        }
+        catch ( Exception e )
+        {
+            throw new ScmException( "Can't add system environment.", e );
+        }
+
+        command.addEnvironment( "SSDIR", repo.getVssdir() );
+
+        command.setExecutable( VssConstants.SS_EXE );
+
+        command.createArgument().setValue( VssConstants.COMMAND_HISTORY );
+
+        command.createArgument().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() );
+
+        //User identification to get access to vss repository
+        if ( repo.getUserPassword() != null )
+        {
+            command.createArgument().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() );
+        }
+
+        //Display the history of an entire project list
+        command.createArgument().setValue( VssConstants.FLAG_RECURSION );
+
+        //Ignore: Do not ask for input under any circumstances.
+        command.createArgument().setValue( VssConstants.FLAG_AUTORESPONSE_DEF );
+
+        //Display only versions that fall within specified data range.
+        if ( startDate != null )
+        {
+            SimpleDateFormat sdf = new SimpleDateFormat( "dd/MM/yyyy", Locale.ENGLISH );
+            String dateRange = sdf.format( endDate ) + "~" + sdf.format( startDate );
+            command.createArgument().setValue( VssConstants.FLAG_VERSION_DATE + dateRange );
+        }
+        return command;
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommand.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java Tue Jan 31 12:34:20 2006
@@ -0,0 +1,63 @@
+package org.apache.maven.scm.provider.vss.repository;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.codehaus.plexus.util.StringUtils;
+
+public class VssScmProviderRepository
+    extends ScmProviderRepository
+{
+    private String vssdir;
+
+    private String project;
+
+    public VssScmProviderRepository( String user, String password, String vssdir, String project )
+    {
+        super();
+        setUser( user );
+        setPassword( password );
+        this.vssdir = StringUtils.replace( vssdir, "/", "\\" );
+        this.project = StringUtils.replace( project, "/", "\\" );
+    }
+
+    public String getProject()
+    {
+        return project;
+    }
+
+    public String getVssdir()
+    {
+        return vssdir;
+    }
+
+    public String getUserPassword()
+    {
+        String userPassword = null;
+
+        if ( !StringUtils.isEmpty( getUser() ) )
+        {
+            userPassword = getUser();
+
+            if ( !StringUtils.isEmpty( getPassword() ) )
+            {
+                userPassword += "," + getPassword();
+            }
+        }
+        return userPassword;
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/plexus/components.xml?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/plexus/components.xml Tue Jan 31 12:34:20 2006
@@ -0,0 +1,9 @@
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.scm.provider.ScmProvider</role>
+      <role-hint>vss</role-hint>
+      <implementation>org.apache.maven.scm.provider.vss.VssScmProvider</implementation>
+    </component>
+  </components>
+</component-set>

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/VssScmProviderTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/VssScmProviderTest.java?rev=373905&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/VssScmProviderTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/VssScmProviderTest.java Tue Jan 31 12:34:20 2006
@@ -0,0 +1,72 @@
+package org.apache.maven.scm.provider.vss;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.manager.ScmManager;
+import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class VssScmProviderTest
+    extends ScmTestCase
+{
+    private ScmManager scmManager;
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        scmManager = getScmManager();
+    }
+
+    public void testScmUrl()
+        throws Exception
+    {
+        testUrl( "scm:vss|vssdir|projectPath", "vssdir", "projectPath", null, null );
+        testUrl( "scm:vss|username@vssdir|projectPath", "vssdir", "projectPath", "username", null );
+        testUrl( "scm:vss|username|password@vssdir|projectPath", "vssdir", "projectPath", "username", "password" );
+    }
+
+    private void testUrl( String scmUrl, String expectedVssDir, String expectedProjectPath, String expectedUser,
+                          String expectedPassword )
+        throws Exception
+    {
+        ScmRepository repository = scmManager.makeScmRepository( scmUrl );
+
+        assertNotNull( "ScmManager.makeScmRepository() returned null", repository );
+
+        assertNotNull( "The provider repository was null.", repository.getProviderRepository() );
+
+        assertTrue( "The SCM Repository isn't a " + VssScmProviderRepository.class.getName() + ".",
+                    repository.getProviderRepository() instanceof VssScmProviderRepository );
+
+        VssScmProviderRepository providerRepository = (VssScmProviderRepository) repository.getProviderRepository();
+
+        assertEquals( "vssdir is incorrect", expectedVssDir, providerRepository.getVssdir() );
+
+        assertEquals( "projectPath is incorrect", expectedProjectPath, providerRepository.getProject() );
+
+        assertEquals( "User is incorrect", expectedUser, providerRepository.getUser() );
+
+        assertEquals( "Password is incorrect", expectedPassword, providerRepository.getPassword() );
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/VssScmProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/VssScmProviderTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message