You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-commits@maven.apache.org by ev...@apache.org on 2006/02/26 12:17:05 UTC
svn commit: r381077 [3/6] - in /maven/scm/trunk/maven-scm-providers: ./
maven-scm-provider-svn/ maven-scm-providers-svn/
maven-scm-providers-svn/maven-scm-provider-svn-commons/
maven-scm-providers-svn/maven-scm-provider-svn-commons/src/
maven-scm-provi...
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommand.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommand.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommand.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,103 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.diff;
+
+/*
+ * 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.diff.AbstractDiffCommand;
+import org.apache.maven.scm.command.diff.DiffScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.command.SvnCommand;
+import org.apache.maven.scm.provider.svn.command.diff.SvnDiffConsumer;
+import org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class SvnDiffCommand
+ extends AbstractDiffCommand
+ implements SvnCommand
+{
+ protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet, String startRevision,
+ String endRevision )
+ throws ScmException
+ {
+ Commandline cl =
+ createCommandLine( (SvnScmProviderRepository) repo, fileSet.getBasedir(), startRevision, endRevision );
+
+ SvnDiffConsumer consumer = new SvnDiffConsumer( getLogger(), fileSet.getBasedir() );
+
+ CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+ getLogger().info( "Executing: " + cl );
+ getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
+
+ int exitCode;
+
+ try
+ {
+ exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
+ }
+ catch ( CommandLineException ex )
+ {
+ throw new ScmException( "Error while executing command.", ex );
+ }
+
+ if ( exitCode != 0 )
+ {
+ return new DiffScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
+ }
+
+ return new DiffScmResult( cl.toString(), consumer.getChangedFiles(), consumer.getDifferences(),
+ consumer.getPatch() );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public static Commandline createCommandLine( SvnScmProviderRepository repository, File workingDirectory,
+ String startRevision, String endRevision )
+ {
+ Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( workingDirectory, repository );
+
+ cl.createArgument().setValue( "diff" );
+
+ if ( startRevision != null )
+ {
+ cl.createArgument().setValue( "-r" );
+
+ if ( endRevision != null )
+ {
+ cl.createArgument().setValue( startRevision + ":" + endRevision );
+ }
+ else
+ {
+ cl.createArgument().setValue( startRevision );
+ }
+ }
+
+ return cl;
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommand.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveCommand.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveCommand.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveCommand.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,94 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.remove;
+
+/*
+ * 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.ScmResult;
+import org.apache.maven.scm.command.remove.AbstractRemoveCommand;
+import org.apache.maven.scm.command.remove.RemoveScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.command.SvnCommand;
+import org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class SvnRemoveCommand
+ extends AbstractRemoveCommand
+ implements SvnCommand
+{
+ protected ScmResult executeRemoveCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message )
+ throws ScmException
+ {
+ if ( fileSet.getFiles().length == 0 )
+ {
+ throw new ScmException( "You must provide at least one file/directory to remove" );
+ }
+
+ Commandline cl = createCommandLine( fileSet.getBasedir(), fileSet.getFiles() );
+
+ SvnRemoveConsumer consumer = new SvnRemoveConsumer( getLogger() );
+
+ CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+ getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath() );
+ getLogger().info( "Command line: " + cl );
+
+ int exitCode;
+
+ try
+ {
+ exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
+ }
+ catch ( CommandLineException ex )
+ {
+ throw new ScmException( "Error while executing command.", ex );
+ }
+
+ if ( exitCode != 0 )
+ {
+ return new RemoveScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
+ }
+
+ return new RemoveScmResult( cl.toString(), consumer.getRemovedFiles() );
+ }
+
+ private static Commandline createCommandLine( File workingDirectory, File[] files )
+ {
+ // Base command line doesn't make sense here - username/password not needed, and non-interactive/non-recusive is not valid
+
+ Commandline cl = new Commandline();
+
+ cl.setExecutable( "svn" );
+
+ cl.setWorkingDirectory( workingDirectory.getAbsolutePath() );
+
+ cl.createArgument().setValue( "remove" );
+
+ SvnCommandLineUtils.addFiles( cl, files );
+
+ return cl;
+ }
+
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveCommand.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveConsumer.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveConsumer.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveConsumer.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveConsumer.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,85 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.remove;
+
+/*
+ * 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.ScmFile;
+import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.log.ScmLogger;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class SvnRemoveConsumer
+ implements StreamConsumer
+{
+ private ScmLogger logger;
+
+ private List removedFiles = new ArrayList();
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public SvnRemoveConsumer( ScmLogger logger )
+ {
+ this.logger = logger;
+ }
+
+ // ----------------------------------------------------------------------
+ // StreamConsumer Implementation
+ // ----------------------------------------------------------------------
+
+ public void consumeLine( String line )
+ {
+ if ( line.length() <= 3 )
+ {
+ logger.warn( "Unexpected input, the line must be at least three characters long. Line: '" + line + "'." );
+
+ return;
+ }
+
+ String statusString = line.substring( 0, 1 );
+
+ String file = line.substring( 3 );
+
+ ScmFileStatus status;
+
+ if ( statusString.equals( "D" ) )
+ {
+ status = ScmFileStatus.DELETED;
+ }
+ else
+ {
+ logger.info( "Unknown file status: '" + statusString + "'." );
+
+ return;
+ }
+
+ removedFiles.add( new ScmFile( file, status ) );
+ }
+
+ public List getRemovedFiles()
+ {
+ return removedFiles;
+ }
+
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remove/SvnRemoveConsumer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommand.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommand.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommand.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,82 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.status;
+
+/*
+ * 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.status.AbstractStatusCommand;
+import org.apache.maven.scm.command.status.StatusScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.command.SvnCommand;
+import org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class SvnStatusCommand
+ extends AbstractStatusCommand
+ implements SvnCommand
+{
+ protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet )
+ throws ScmException
+ {
+ Commandline cl = createCommandLine( (SvnScmProviderRepository) repo, fileSet );
+
+ SvnStatusConsumer consumer = new SvnStatusConsumer( getLogger(), fileSet.getBasedir() );
+
+ CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+ getLogger().info( "Executing: " + cl );
+ getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
+
+ int exitCode;
+
+ try
+ {
+ exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
+ }
+ catch ( CommandLineException ex )
+ {
+ throw new ScmException( "Error while executing command.", ex );
+ }
+
+ if ( exitCode != 0 )
+ {
+ return new StatusScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
+ }
+
+ return new StatusScmResult( cl.toString(), consumer.getChangedFiles() );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public static Commandline createCommandLine( SvnScmProviderRepository repository, ScmFileSet fileSet )
+ {
+ Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( fileSet.getBasedir(), repository );
+
+ cl.createArgument().setValue( "status" );
+
+ return cl;
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommand.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusConsumer.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusConsumer.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusConsumer.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusConsumer.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,115 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.status;
+
+/*
+ * 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.ScmFile;
+import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.log.ScmLogger;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class SvnStatusConsumer
+ implements StreamConsumer
+{
+ private ScmLogger logger;
+
+ private File workingDirectory;
+
+ private List changedFiles = new ArrayList();
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public SvnStatusConsumer( ScmLogger logger, File workingDirectory )
+ {
+ this.logger = logger;
+
+ this.workingDirectory = workingDirectory;
+ }
+
+ // ----------------------------------------------------------------------
+ // StreamConsumer Implementation
+ // ----------------------------------------------------------------------
+
+ public void consumeLine( String line )
+ {
+ if ( line.length() <= 7 )
+ {
+ logger.warn( "Unexpected input, the line must be at least seven characters long. Line: '" + line + "'." );
+
+ return;
+ }
+
+ String statusString = line.substring( 0, 1 );
+
+ String file = line.substring( 7 );
+
+ ScmFileStatus status;
+
+ if ( statusString.equals( "A" ) )
+ {
+ status = ScmFileStatus.ADDED;
+ }
+ else if ( statusString.equals( "M" ) )
+ {
+ status = ScmFileStatus.MODIFIED;
+ }
+ else if ( statusString.equals( "D" ) )
+ {
+ status = ScmFileStatus.DELETED;
+ }
+ else if ( statusString.equals( "?" ) )
+ {
+ status = ScmFileStatus.UNKNOWN;
+ }
+ else if ( statusString.equals( "C" ) )
+ {
+ status = ScmFileStatus.CONFLICT;
+ }
+ else if ( statusString.equals( "L" ) )
+ {
+ status = ScmFileStatus.LOCKED;
+ }
+ else
+ {
+ logger.info( "Unknown file status: '" + statusString + "'." );
+
+ status = ScmFileStatus.UNKNOWN;
+ }
+
+ // If the file isn't a file; don't add it.
+ if ( !new File( workingDirectory, file ).isFile() )
+ {
+ return;
+ }
+
+ changedFiles.add( new ScmFile( file, status ) );
+ }
+
+ public List getChangedFiles()
+ {
+ return changedFiles;
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusConsumer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommand.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommand.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommand.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,148 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.tag;
+
+/*
+ * 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.ScmFile;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.command.tag.AbstractTagCommand;
+import org.apache.maven.scm.command.tag.TagScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.SvnTagBranchUtils;
+import org.apache.maven.scm.provider.svn.command.SvnCommand;
+import org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ * @todo since this is just a copy, use that instead.
+ */
+public class SvnTagCommand
+ extends AbstractTagCommand
+ implements SvnCommand
+{
+ public ScmResult executeTagCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag )
+ throws ScmException
+ {
+ if ( tag == null )
+ {
+ throw new ScmException( "tag must be specified" );
+ }
+
+ if ( fileSet.getFiles().length != 0 )
+ {
+ throw new ScmException( "This provider doesn't support tagging subsets of a directory" );
+ }
+
+ SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;
+
+ File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );
+
+ try
+ {
+ // TODO: should message be customisable?
+ FileUtils.fileWrite( messageFile.getAbsolutePath(), "[maven-scm] copy for tag " + tag );
+ }
+ catch ( IOException ex )
+ {
+ return new TagScmResult( null,
+ "Error while making a temporary file for the commit message: " + ex.getMessage(),
+ null, false );
+ }
+
+ Commandline cl = createCommandLine( repository, fileSet.getBasedir(), tag, messageFile );
+
+ CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
+
+ CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+ getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath() );
+ getLogger().info( "Command line: " + cl );
+
+ int exitCode;
+
+ try
+ {
+ exitCode = SvnCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
+ }
+ catch ( CommandLineException ex )
+ {
+ throw new ScmException( "Error while executing command.", ex );
+ }
+
+ if ( exitCode != 0 )
+ {
+ // TODO: Improve this error message
+ return new TagScmResult( cl.toString(), "The svn tag command failed.", stderr.getOutput(), false );
+ }
+
+ List fileList = new ArrayList();
+ List files = null;
+ try
+ {
+ files = FileUtils.getFiles( fileSet.getBasedir(), "**", "**/.svn/**", false );
+ }
+ catch ( IOException e )
+ {
+ throw new ScmException( "Error while executing command.", e );
+ }
+
+ for ( Iterator i = files.iterator(); i.hasNext(); )
+ {
+ File f = (File) i.next();
+ fileList.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
+ }
+
+ return new TagScmResult( cl.toString(), fileList );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ private static Commandline createCommandLine( SvnScmProviderRepository repository, File workingDirectory,
+ String tag, File messageFile )
+ {
+ Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( workingDirectory, repository );
+
+ cl.createArgument().setValue( "copy" );
+
+ cl.createArgument().setValue( "--file" );
+
+ cl.createArgument().setValue( messageFile.getAbsolutePath() );
+
+ cl.createArgument().setValue( "." );
+
+ // Note: this currently assumes you have the tag base checked out too
+ cl.createArgument().setValue( SvnTagBranchUtils.resolveTagUrl( repository, tag ) );
+
+ return cl;
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommand.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,127 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.update;
+
+/*
+ * 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.ChangeLogCommand;
+import org.apache.maven.scm.command.update.AbstractUpdateCommand;
+import org.apache.maven.scm.command.update.UpdateScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.SvnTagBranchUtils;
+import org.apache.maven.scm.provider.svn.command.SvnCommand;
+import org.apache.maven.scm.provider.svn.command.update.SvnUpdateScmResult;
+import org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils;
+import org.apache.maven.scm.provider.svn.svnexe.command.changelog.SvnChangeLogCommand;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+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 java.io.File;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class SvnUpdateCommand
+ extends AbstractUpdateCommand
+ implements SvnCommand
+{
+
+ protected UpdateScmResult executeUpdateCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag )
+ throws ScmException
+ {
+ Commandline cl = createCommandLine( (SvnScmProviderRepository) repo, fileSet.getBasedir(), tag );
+
+ SvnUpdateConsumer consumer = new SvnUpdateConsumer( getLogger(), fileSet.getBasedir() );
+
+ CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+ getLogger().info( "Executing: " + cl );
+ getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
+
+ int exitCode;
+
+ try
+ {
+ exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
+ }
+ catch ( CommandLineException ex )
+ {
+ throw new ScmException( "Error while executing command.", ex );
+ }
+
+ if ( exitCode != 0 )
+ {
+ return new UpdateScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
+ }
+
+ return new SvnUpdateScmResult( cl.toString(), consumer.getUpdatedFiles(), consumer.getRevision() );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public static Commandline createCommandLine( SvnScmProviderRepository repository, File workingDirectory,
+ String tag )
+ {
+ if ( tag != null && StringUtils.isEmpty( tag.trim() ) )
+ {
+ tag = null;
+ }
+
+ Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( workingDirectory, repository );
+
+ if ( tag == null || SvnTagBranchUtils.isRevisionSpecifier( tag ) )
+ {
+ cl.createArgument().setValue( "update" );
+
+ if ( tag != null )
+ {
+ cl.createArgument().setValue( "-r" );
+ cl.createArgument().setValue( tag );
+ }
+ }
+ else
+ {
+ // The tag specified does not appear to be numeric, so assume it refers
+ // to a branch/tag url and perform a switch operation rather than update
+ cl.createArgument().setValue( "switch" );
+ cl.createArgument().setValue( SvnTagBranchUtils.resolveTagUrl( repository, tag ) );
+ cl.createArgument().setValue( workingDirectory.getAbsolutePath() );
+ }
+
+ return cl;
+ }
+
+ /**
+ * @see org.apache.maven.scm.command.update.AbstractUpdateCommand#getChangeLogCommand()
+ */
+ protected ChangeLogCommand getChangeLogCommand()
+ {
+ SvnChangeLogCommand command = new SvnChangeLogCommand();
+
+ command.setLogger( getLogger() );
+
+ return command;
+ }
+
+
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateCommand.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateConsumer.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateConsumer.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateConsumer.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateConsumer.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,155 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.update;
+
+/*
+ * 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.ScmFile;
+import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.log.ScmLogger;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class SvnUpdateConsumer
+ implements StreamConsumer
+{
+ private final static String UPDATED_TO_REVISION_TOKEN = "Updated to revision";
+
+ private final static String AT_REVISION_TOKEN = "At revision";
+
+ private final static String RESTORED_TOKEN = "Restored";
+
+ private ScmLogger logger;
+
+ private File workingDirectory;
+
+ private List updatedFiles = new ArrayList();
+
+ private int revision;
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public SvnUpdateConsumer( ScmLogger logger, File workingDirectory )
+ {
+ this.logger = logger;
+
+ this.workingDirectory = workingDirectory;
+ }
+
+ // ----------------------------------------------------------------------
+ // StreamConsumer Implementation
+ // ----------------------------------------------------------------------
+
+ public void consumeLine( String line )
+ {
+ logger.debug( line );
+
+ if ( line.length() <= 3 )
+ {
+ logger.warn( "Unexpected input, the line must be at least three characters long. Line: '" + line + "'." );
+
+ return;
+ }
+
+ String statusString = line.substring( 0, 1 );
+
+ String file = line.substring( 3 ).trim();
+
+ ScmFileStatus status;
+
+ if ( line.startsWith( UPDATED_TO_REVISION_TOKEN ) )
+ {
+ String revisionString = line.substring( UPDATED_TO_REVISION_TOKEN.length() + 1, line.length() - 1 );
+
+ revision = parseInt( revisionString );
+
+ return;
+ }
+ else if ( line.startsWith( AT_REVISION_TOKEN ) )
+ {
+ String revisionString = line.substring( AT_REVISION_TOKEN.length() + 1, line.length() - 1 );
+
+ revision = parseInt( revisionString );
+
+ return;
+ }
+ else if ( line.startsWith( RESTORED_TOKEN ) )
+ {
+ return;
+ }
+ else if ( statusString.equals( "A" ) )
+ {
+ status = ScmFileStatus.ADDED;
+ }
+ else if ( statusString.equals( "U" ) )
+ {
+ status = ScmFileStatus.UPDATED;
+ }
+ else if ( statusString.equals( "D" ) )
+ {
+ status = ScmFileStatus.DELETED;
+ }
+ else
+ {
+ logger.info( "Unknown file status: '" + statusString + "' in line " + line + "." );
+
+ return;
+ }
+
+ // If the file isn't a file; don't add it.
+ if ( !new File( workingDirectory, file ).isFile() )
+ {
+ logger.debug( "Skipping non-file: " + file );
+ return;
+ }
+
+ updatedFiles.add( new ScmFile( file, status ) );
+ }
+
+ public List getUpdatedFiles()
+ {
+ return updatedFiles;
+ }
+
+ public int getRevision()
+ {
+ return revision;
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ private int parseInt( String revisionString )
+ {
+ try
+ {
+ return Integer.parseInt( revisionString );
+ }
+ catch ( NumberFormatException ex )
+ {
+ return 0;
+ }
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/update/SvnUpdateConsumer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/resources/META-INF/plexus/components.xml?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/resources/META-INF/plexus/components.xml Sun Feb 26 03:16:52 2006
@@ -0,0 +1,9 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.scm.provider.ScmProvider</role>
+ <role-hint>svn</role-hint>
+ <implementation>org.apache.maven.scm.provider.svn.svnexe.SvnExeScmProvider</implementation>
+ </component>
+ </components>
+</component-set>
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/SvnScmTestUtils.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/SvnScmTestUtils.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/SvnScmTestUtils.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/SvnScmTestUtils.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,135 @@
+package org.apache.maven.scm.provider.svn.svnexe;
+
+/*
+ * 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 junit.framework.Assert;
+import org.apache.maven.scm.ScmTestCase;
+import org.codehaus.plexus.util.FileUtils;
+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 java.io.File;
+import java.io.FileInputStream;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public final class SvnScmTestUtils
+{
+ private SvnScmTestUtils()
+ {
+ }
+
+ public static void initializeRepository( File repositoryRoot, File dump )
+ throws Exception
+ {
+ if ( repositoryRoot.exists() )
+ {
+ FileUtils.deleteDirectory( repositoryRoot );
+ }
+
+ Assert.assertTrue( "Could not make repository root directory: " + repositoryRoot.getAbsolutePath(),
+ repositoryRoot.mkdirs() );
+
+ ScmTestCase.execute( repositoryRoot.getParentFile(), "svnadmin", "create " + repositoryRoot.getName() );
+
+ loadSvnDump( repositoryRoot, dump );
+ }
+
+ private static void loadSvnDump( File repositoryRoot, File dump )
+ throws Exception
+ {
+ Assert.assertTrue( "The dump file doesn't exist: " + dump.getAbsolutePath(), dump.exists() );
+
+ Commandline cl = new Commandline();
+
+ cl.setExecutable( "svnadmin" );
+
+ cl.setWorkingDirectory( repositoryRoot.getParentFile().getAbsolutePath() );
+
+ cl.createArgument().setValue( "load" );
+
+ cl.createArgument().setValue( repositoryRoot.getAbsolutePath() );
+
+ CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
+
+ CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+ int exitValue = CommandLineUtils.executeCommandLine( cl, new FileInputStream( dump ), stdout, stderr );
+
+ if ( exitValue != 0 )
+ {
+ System.err.println( "-----------------------------------------" );
+ System.err.println( "Command line: " + cl );
+ System.err.println( "Working directory: " + cl.getWorkingDirectory() );
+ System.err.println( "-----------------------------------------" );
+ System.err.println( "Standard output: " );
+ System.err.println( "-----------------------------------------" );
+ System.err.println( stdout.getOutput() );
+ System.err.println( "-----------------------------------------" );
+
+ System.err.println( "Standard error: " );
+ System.err.println( "-----------------------------------------" );
+ System.err.println( stderr.getOutput() );
+ System.err.println( "-----------------------------------------" );
+ }
+
+ if ( exitValue != 0 )
+ {
+ Assert.fail( "Exit value wasn't 0, was:" + exitValue );
+ }
+ }
+
+ public static String getScmUrl( File repositoryRootFile )
+ throws CommandLineException
+ {
+ String repositoryRoot = repositoryRootFile.getAbsolutePath();
+
+ // TODO: it'd be great to build this into CommandLineUtils somehow
+ // TODO: some way without a custom cygwin sys property?
+ if ( "true".equals( System.getProperty( "cygwin" ) ) )
+ {
+ Commandline cl = new Commandline();
+
+ cl.setExecutable( "cygpath" );
+
+ cl.createArgument().setValue( "--unix" );
+
+ cl.createArgument().setValue( repositoryRoot );
+
+ CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
+
+ int exitValue = CommandLineUtils.executeCommandLine( cl, stdout, null );
+
+ if ( exitValue != 0 )
+ {
+ throw new CommandLineException( "Unable to convert cygwin path, exit code = " + exitValue );
+ }
+
+ repositoryRoot = stdout.getOutput().trim();
+ }
+ else if ( System.getProperty( "os.name" ).startsWith( "Windows" ) )
+ {
+ repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
+ }
+
+ return "scm:svn:file://" + repositoryRoot;
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/SvnScmTestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/SvnScmTestUtils.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogCommandTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogCommandTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,135 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.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.ScmTestCase;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.File;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class SvnChangeLogCommandTest
+ extends ScmTestCase
+{
+ public void testCommandLineNoDates()
+ throws Exception
+ {
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, null, null,
+ "svn --non-interactive log -v http://foo.com/svn/trunk" );
+ }
+
+ public void testCommandLineWithDates()
+ throws Exception
+ {
+ Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, GMT_TIME_ZONE );
+ Date endDate = getDate( 2003, Calendar.OCTOBER, 10, GMT_TIME_ZONE );
+
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, startDate, endDate,
+ "svn --non-interactive log -v -r \"{2003-09-10 00:00:00 +0000}:{2003-10-10 00:00:00 +0000}\" http://foo.com/svn/trunk" );
+ }
+
+ public void testCommandLineStartDateOnly()
+ throws Exception
+ {
+ Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, 1, 1, 1, GMT_TIME_ZONE );
+
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, startDate, null,
+ "svn --non-interactive log -v -r \"{2003-09-10 01:01:01 +0000}:HEAD\" http://foo.com/svn/trunk" );
+ }
+
+ public void testCommandLineDateFormat()
+ throws Exception
+ {
+ Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, 1, 1, 1, GMT_TIME_ZONE );
+ Date endDate = getDate( 2005, Calendar.NOVEMBER, 13, 23, 23, 23, GMT_TIME_ZONE );
+
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, startDate, endDate,
+ "svn --non-interactive log -v -r \"{2003-09-10 01:01:01 +0000}:{2005-11-13 23:23:23 +0000}\" http://foo.com/svn/trunk" );
+ }
+
+ public void testCommandLineEndDateOnly()
+ throws Exception
+ {
+ Date endDate = getDate( 2003, Calendar.NOVEMBER, 10, GMT_TIME_ZONE );
+
+ // Only specifying end date should print no dates at all
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, null, endDate,
+ "svn --non-interactive log -v http://foo.com/svn/trunk" );
+ }
+
+ public void testCommandLineWithBranchNoDates()
+ throws Exception
+ {
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", "my-test-branch", null, null,
+ "svn --non-interactive log -v http://foo.com/svn/branches/my-test-branch http://foo.com/svn/trunk" );
+ }
+
+ public void testCommandLineWithBranchStartDateOnly()
+ throws Exception
+ {
+ Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, 1, 1, 1, GMT_TIME_ZONE );
+
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", "my-test-branch", startDate, null,
+ "svn --non-interactive log -v -r \"{2003-09-10 01:01:01 +0000}:HEAD\" http://foo.com/svn/branches/my-test-branch http://foo.com/svn/trunk" );
+ }
+
+ public void testCommandLineWithBranchEndDateOnly()
+ throws Exception
+ {
+ Date endDate = getDate( 2003, Calendar.OCTOBER, 10, 1, 1, 1, GMT_TIME_ZONE );
+
+ // Only specifying end date should print no dates at all
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", "my-test-branch", null, endDate,
+ "svn --non-interactive log -v http://foo.com/svn/branches/my-test-branch http://foo.com/svn/trunk" );
+ }
+
+ public void testCommandLineWithBranchBothDates()
+ throws Exception
+ {
+ Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, GMT_TIME_ZONE );
+ Date endDate = getDate( 2003, Calendar.OCTOBER, 10, GMT_TIME_ZONE );
+
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", "my-test-branch", startDate, endDate,
+ "svn --non-interactive log -v -r \"{2003-09-10 00:00:00 +0000}:{2003-10-10 00:00:00 +0000}\" http://foo.com/svn/branches/my-test-branch http://foo.com/svn/trunk" );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ private void testCommandLine( String scmUrl, String branch, Date startDate, Date endDate, String commandLine )
+ throws Exception
+ {
+ File workingDirectory = getTestFile( "target/svn-update-command-test" );
+
+ ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
+
+ SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
+
+ Commandline cl =
+ SvnChangeLogCommand.createCommandLine( svnRepository, workingDirectory, branch, startDate, endDate );
+
+ assertEquals( commandLine, cl.toString() );
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogCommandTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogCommandTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,137 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.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.DefaultLog;
+import org.codehaus.plexus.PlexusTestCase;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class SvnChangeLogConsumerTest
+ extends PlexusTestCase
+{
+ public void testConsumerWithPattern1()
+ throws Exception
+ {
+ SvnChangeLogConsumer consumer = new SvnChangeLogConsumer( new DefaultLog(), null );
+
+ File f = getTestFile( "/src/test/resources/svn/changelog/svnlog.txt" );
+
+ BufferedReader r = new BufferedReader( new FileReader( f ) );
+
+ String line;
+
+ while ( ( line = r.readLine() ) != null )
+ {
+ consumer.consumeLine( line );
+ }
+
+ List modifications = consumer.getModifications();
+
+ System.out.println( "Text format:" );
+
+ System.out.println( "nb modifications : " + modifications.size() );
+
+ for ( Iterator i = modifications.iterator(); i.hasNext(); )
+ {
+ ChangeSet entry = (ChangeSet) i.next();
+
+ System.out.println( "Author:" + entry.getAuthor() );
+
+ System.out.println( "Date:" + entry.getDate() );
+
+ System.out.println( "Comment:" + entry.getComment() );
+
+ List files = entry.getFiles();
+
+ for ( Iterator it = files.iterator(); it.hasNext(); )
+ {
+ ChangeFile file = (ChangeFile) it.next();
+
+ System.out.println( "File:" + file.getName() );
+ }
+
+ System.out.println( "==============================" );
+ }
+
+ System.out.println( "XML format:" );
+
+ System.out.println( "nb modifications : " + modifications.size() );
+
+ for ( Iterator i = modifications.iterator(); i.hasNext(); )
+ {
+ ChangeSet entry = (ChangeSet) i.next();
+
+ System.out.println( entry.toXML() );
+
+ System.out.println( "==============================" );
+ }
+ }
+
+ public void testConsumerWithPattern2()
+ throws Exception
+ {
+ SvnChangeLogConsumer consumer = new SvnChangeLogConsumer( new DefaultLog(), null );
+
+ File f = getTestFile( "/src/test/resources/svn/changelog/svnlog2.txt" );
+
+ BufferedReader r = new BufferedReader( new FileReader( f ) );
+
+ String line;
+
+ while ( ( line = r.readLine() ) != null )
+ {
+ consumer.consumeLine( line );
+ }
+
+ List modifications = consumer.getModifications();
+
+ System.out.println( "nb modifications : " + modifications.size() );
+
+ for ( Iterator i = modifications.iterator(); i.hasNext(); )
+ {
+ ChangeSet entry = (ChangeSet) i.next();
+
+ System.out.println( "Author:" + entry.getAuthor() );
+
+ System.out.println( "Date:" + entry.getDate() );
+
+ System.out.println( "Comment:" + entry.getComment() );
+
+ List files = entry.getFiles();
+
+ for ( Iterator it = files.iterator(); it.hasNext(); )
+ {
+ ChangeFile file = (ChangeFile) it.next();
+
+ System.out.println( "File:" + file.getName() );
+ }
+
+ System.out.println( "==============================" );
+ }
+ }
+}
\ No newline at end of file
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTckTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTckTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTckTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTckTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,42 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.checkin;
+
+/*
+ * 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.svn.svnexe.SvnScmTestUtils;
+import org.apache.maven.scm.tck.command.checkin.CheckInCommandTckTest;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class SvnCheckInCommandTckTest
+ extends CheckInCommandTckTest
+{
+ public String getScmUrl()
+ throws Exception
+ {
+ return SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(), "trunk" ) );
+ }
+
+ public void initRepo()
+ throws Exception
+ {
+ SvnScmTestUtils.initializeRepository( getRepositoryRoot(), getTestFile( "src/test/resources/tck/tck.dump" ) );
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTckTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTckTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,97 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.checkin;
+
+/*
+ * 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.ScmFileSet;
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class SvnCheckInCommandTest
+ extends ScmTestCase
+{
+ private File messageFile;
+
+ private String messageFileString;
+
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ messageFile = new File( "commit-message" );
+
+ String path = messageFile.getAbsolutePath();
+ if ( path.indexOf( ' ' ) >= 0 )
+ {
+ path = "\"" + path + "\"";
+ }
+ messageFileString = "--file " + path;
+ }
+
+ public void testCommandLineWithEmptyTag()
+ throws Exception
+ {
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", "svn --non-interactive commit " + messageFileString );
+ }
+
+ public void testCommandLineWithoutTag()
+ throws Exception
+ {
+ testCommandLine( "scm:svn:http://foo.com/svn/trunk", "svn --non-interactive commit " + messageFileString );
+ }
+
+ public void testCommandLineTag()
+ throws Exception
+ {
+ testCommandLine( "scm:svn:http://anonymous@foo.com/svn/trunk",
+ "svn --username anonymous --non-interactive commit " + messageFileString );
+ }
+
+ public void testCommandLineWithUsernameAndTag()
+ throws Exception
+ {
+ testCommandLine( "scm:svn:http://anonymous@foo.com/svn/trunk",
+ "svn --username anonymous --non-interactive commit " + messageFileString );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ private void testCommandLine( String scmUrl, String commandLine )
+ throws Exception
+ {
+ File workingDirectory = getTestFile( "target/svn-checkin-command-test" );
+
+ ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
+
+ SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
+
+ Commandline cl =
+ SvnCheckInCommand.createCommandLine( svnRepository, new ScmFileSet( workingDirectory ), messageFile );
+
+ assertEquals( commandLine, cl.toString() );
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkin/SvnCheckInCommandTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTckTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTckTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTckTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTckTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,42 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.checkout;
+
+/*
+ * 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.svn.svnexe.SvnScmTestUtils;
+import org.apache.maven.scm.tck.command.checkout.CheckOutCommandTckTest;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class SvnCheckOutCommandTckTest
+ extends CheckOutCommandTckTest
+{
+ public String getScmUrl()
+ throws Exception
+ {
+ return SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(), "trunk" ) );
+ }
+
+ public void initRepo()
+ throws Exception
+ {
+ SvnScmTestUtils.initializeRepository( getRepositoryRoot(), getTestFile( "src/test/resources/tck/tck.dump" ) );
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTckTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTckTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,90 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.checkout;
+
+/*
+ * 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.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class SvnCheckOutCommandTest
+ extends ScmTestCase
+{
+ private File workingDirectory;
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ workingDirectory = getTestFile( "target/svn-checkout-command-test" );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public void testCommandLineWithoutRevision()
+ throws Exception
+ {
+ testCommandLine( getScmManager(), "scm:svn:http://foo.com/svn/trunk", null,
+ "svn --non-interactive checkout http://foo.com/svn/trunk " + workingDirectory.getName() );
+ }
+
+ public void testCommandLineWithEmptyRevision()
+ throws Exception
+ {
+ testCommandLine( getScmManager(), "scm:svn:http://foo.com/svn/trunk", "",
+ "svn --non-interactive checkout -r http://foo.com/svn/trunk " + workingDirectory.getName() );
+ }
+
+ public void testCommandLineWithRevision()
+ throws Exception
+ {
+ testCommandLine( getScmManager(), "scm:svn:http://foo.com/svn/trunk", "10",
+ "svn --non-interactive checkout -r 10 http://foo.com/svn/trunk " +
+ workingDirectory.getName() );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ private void testCommandLine( ScmManager scmManager, String scmUrl, String revision, String commandLine )
+ throws Exception
+ {
+ ScmRepository repository = scmManager.makeScmRepository( scmUrl );
+
+ SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
+
+ Commandline cl =
+ SvnCheckOutCommand.createCommandLine( svnRepository, workingDirectory, revision, svnRepository.getUrl() );
+
+ assertEquals( commandLine, cl.toString() );
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/checkout/SvnCheckOutCommandTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommandTckTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommandTckTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommandTckTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommandTckTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,42 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.diff;
+
+/*
+ * 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.svn.svnexe.SvnScmTestUtils;
+import org.apache.maven.scm.tck.command.diff.DiffCommandTckTest;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class SvnDiffCommandTckTest
+ extends DiffCommandTckTest
+{
+ public String getScmUrl()
+ throws Exception
+ {
+ return SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(), "trunk" ) );
+ }
+
+ public void initRepo()
+ throws Exception
+ {
+ SvnScmTestUtils.initializeRepository( getRepositoryRoot(), getTestFile( "src/test/resources/tck/tck.dump" ) );
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommandTckTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/diff/SvnDiffCommandTckTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommandTckTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommandTckTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommandTckTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommandTckTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,42 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.status;
+
+/*
+ * 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.svn.svnexe.SvnScmTestUtils;
+import org.apache.maven.scm.tck.command.status.StatusCommandTckTest;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class SvnStatusCommandTckTest
+ extends StatusCommandTckTest
+{
+ public String getScmUrl()
+ throws Exception
+ {
+ return SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(), "trunk" ) );
+ }
+
+ public void initRepo()
+ throws Exception
+ {
+ SvnScmTestUtils.initializeRepository( getRepositoryRoot(), getTestFile( "src/test/resources/tck/tck.dump" ) );
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommandTckTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/status/SvnStatusCommandTckTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommandTckTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommandTckTest.java?rev=381077&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommandTckTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommandTckTest.java Sun Feb 26 03:16:52 2006
@@ -0,0 +1,44 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.tag;
+
+/*
+ * 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.svn.svnexe.SvnScmTestUtils;
+import org.apache.maven.scm.tck.command.tag.TagCommandTckTest;
+
+import java.io.File;
+
+/**
+ * This test tests the tag command.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class SvnTagCommandTckTest
+ extends TagCommandTckTest
+{
+ public String getScmUrl()
+ throws Exception
+ {
+ return SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(), "trunk" ) );
+ }
+
+ public void initRepo()
+ throws Exception
+ {
+ SvnScmTestUtils.initializeRepository( getRepositoryRoot(), getTestFile( "src/test/resources/tck/tck.dump" ) );
+ }
+}
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommandTckTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/tag/SvnTagCommandTckTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"