[SCM-917] Allow tags to be removed with Subversion implementation
This closes #88
diff --git a/.gitignore b/.gitignore
index d93c7cd..2894b8b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,5 +9,6 @@
build
.idea
.java-version
+nbactions.xml
maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvsexe/src/test/repository/CVSROOT/history
maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvsjava/src/test/repository/CVSROOT/history
diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/ScmUntagParameters.java b/maven-scm-api/src/main/java/org/apache/maven/scm/ScmUntagParameters.java
new file mode 100644
index 0000000..cda8ab3
--- /dev/null
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/ScmUntagParameters.java
@@ -0,0 +1,104 @@
+package org.apache.maven.scm;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 java.io.Serializable;
+
+/**
+ * parameters used by implementation to perform untag operation
+ *
+ * @since 1.11.2
+ */
+public class ScmUntagParameters
+ implements Serializable
+{
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = -7508529445894924957L;
+
+ /**
+ * id of tag to delete/remove
+ */
+ private String tag;
+
+ /**
+ * commit message
+ */
+ private String message;
+
+ /**
+ * constructor with tag and message
+ *
+ * @param tag tag id
+ * @param message commit message
+ */
+ public ScmUntagParameters( String tag, String message )
+ {
+ this.tag = tag;
+ this.message = message;
+ }
+
+ /**
+ * get tag id
+ *
+ * @return tag id
+ */
+ public String getTag()
+ {
+ return tag;
+ }
+
+ /**
+ * set tag id
+ *
+ * @param tag tag id
+ */
+ public void setTag( String tag )
+ {
+ this.tag = tag;
+ }
+
+ /**
+ * get commit message
+ *
+ * @return commit message
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+
+ /**
+ * set commit message
+ *
+ * @param message commit message
+ */
+ public void setMessage( String message )
+ {
+ this.message = message;
+ }
+
+ @Override
+ public String toString()
+ {
+ return ScmUntagParameters.class.getSimpleName() + " [tag=" + tag + ", message=" + message + "]";
+ }
+}
diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/command/untag/AbstractUntagCommand.java b/maven-scm-api/src/main/java/org/apache/maven/scm/command/untag/AbstractUntagCommand.java
index bbbb0c8..d3a9c16 100644
--- a/maven-scm-api/src/main/java/org/apache/maven/scm/command/untag/AbstractUntagCommand.java
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/command/untag/AbstractUntagCommand.java
@@ -24,6 +24,7 @@
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmUntagParameters;
import org.apache.maven.scm.command.AbstractCommand;
import org.apache.maven.scm.provider.ScmProviderRepository;
@@ -31,18 +32,30 @@
public abstract class AbstractUntagCommand
extends AbstractCommand
{
+ /**
+ * execute untag command
+ *
+ * @param repository scm repo
+ * @param fileSet set of files (unused)
+ * @param scmUntagParameters parameters used by untag implementations
+ * @return result of untag command
+ * @throws ScmException in case of error
+ */
protected abstract ScmResult executeUntagCommand( ScmProviderRepository repository,
- ScmFileSet fileSet, String tagName )
+ ScmFileSet fileSet, ScmUntagParameters scmUntagParameters )
throws ScmException;
/** {@inheritDoc} */
+ @Override
public ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
String tagName = parameters.getString( CommandParameter.TAG_NAME );
+ String message = parameters.getString( CommandParameter.MESSAGE, "[maven-scm] remove tag " + tagName );
+ ScmUntagParameters scmUntagParameters = new ScmUntagParameters( tagName, message );
- return executeUntagCommand( repository, fileSet, tagName );
+ return executeUntagCommand( repository, fileSet, scmUntagParameters );
}
}
diff --git a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UntagMojo.java b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UntagMojo.java
index 3368b53..ed915fe 100644
--- a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UntagMojo.java
+++ b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/UntagMojo.java
@@ -43,6 +43,12 @@
@Parameter( property = "tag", required = true )
private String tag;
+ /**
+ * The commit message.
+ */
+ @Parameter( property = "message", required = false )
+ private String message;
+
/** {@inheritDoc} */
public void execute()
throws MojoExecutionException
@@ -59,6 +65,7 @@
CommandParameters parameters = new CommandParameters();
parameters.setString( CommandParameter.TAG_NAME, finalTag );
+ parameters.setString( CommandParameter.MESSAGE, message );
UntagScmResult result = provider.untag( repository, getFileSet(), parameters );
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/untag/GitUntagCommand.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/untag/GitUntagCommand.java
index 8c8798d..31e1543 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/untag/GitUntagCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/untag/GitUntagCommand.java
@@ -24,6 +24,7 @@
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmUntagParameters;
import org.apache.maven.scm.command.untag.AbstractUntagCommand;
import org.apache.maven.scm.command.untag.UntagScmResult;
import org.apache.maven.scm.provider.ScmProviderRepository;
@@ -41,9 +42,11 @@
{
/** {@inheritDoc} */
- public ScmResult executeUntagCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag )
+ public ScmResult executeUntagCommand( ScmProviderRepository repo, ScmFileSet fileSet,
+ ScmUntagParameters scmUntagParameters )
throws ScmException
{
+ String tag = scmUntagParameters.getTag();
if ( tag == null || StringUtils.isEmpty( tag.trim() ) )
{
throw new ScmException( "tag name must be specified" );
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/untag/JGitUntagCommand.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/untag/JGitUntagCommand.java
index 3cc629e..074f8fb 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/untag/JGitUntagCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/untag/JGitUntagCommand.java
@@ -24,6 +24,7 @@
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmUntagParameters;
import org.apache.maven.scm.command.untag.AbstractUntagCommand;
import org.apache.maven.scm.command.untag.UntagScmResult;
import org.apache.maven.scm.log.ScmLogger;
@@ -44,8 +45,10 @@
@Override
protected ScmResult executeUntagCommand( ScmProviderRepository repository, ScmFileSet fileSet,
- String tagName ) throws ScmException
+ ScmUntagParameters scmUntagParameters )
+ throws ScmException
{
+ String tagName = scmUntagParameters.getTag();
if ( tagName == null || StringUtils.isEmpty( tagName.trim() ) )
{
throw new ScmException( "tag name must be specified" );
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/AbstractSvnScmProvider.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/AbstractSvnScmProvider.java
index f1e49e5..de6e929 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/AbstractSvnScmProvider.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/AbstractSvnScmProvider.java
@@ -42,12 +42,14 @@
import org.apache.maven.scm.command.remove.RemoveScmResult;
import org.apache.maven.scm.command.status.StatusScmResult;
import org.apache.maven.scm.command.tag.TagScmResult;
+import org.apache.maven.scm.command.untag.UntagScmResult;
import org.apache.maven.scm.command.update.UpdateScmResult;
import org.apache.maven.scm.provider.AbstractScmProvider;
import org.apache.maven.scm.provider.ScmProviderRepository;
import org.apache.maven.scm.provider.svn.command.SvnCommand;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.provider.svn.util.SvnUtil;
+import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
import org.apache.maven.scm.repository.UnknownRepositoryStructure;
import org.codehaus.plexus.util.StringUtils;
@@ -413,6 +415,19 @@
return (TagScmResult) executeCommand( getTagCommand(), repository, fileSet, parameters );
}
+ protected abstract SvnCommand getUntagCommand();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public UntagScmResult untag( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
+ throws ScmException
+ {
+ return (UntagScmResult) executeCommand( getUntagCommand(), repository.getProviderRepository(),
+ fileSet, parameters );
+ }
+
protected abstract SvnCommand getUpdateCommand();
/**
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/TestSvnScmProvider.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/TestSvnScmProvider.java
index c14c683..7c7afa8 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/TestSvnScmProvider.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/test/java/org/apache/maven/scm/provider/svn/TestSvnScmProvider.java
@@ -79,6 +79,11 @@
return null;
}
+ protected SvnCommand getUntagCommand()
+ {
+ return null;
+ }
+
protected SvnCommand getUpdateCommand()
{
return null;
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/SvnExeScmProvider.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/SvnExeScmProvider.java
index 06393d1..ddf3460 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/SvnExeScmProvider.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/SvnExeScmProvider.java
@@ -44,6 +44,7 @@
import org.apache.maven.scm.provider.svn.svnexe.command.remove.SvnRemoveCommand;
import org.apache.maven.scm.provider.svn.svnexe.command.status.SvnStatusCommand;
import org.apache.maven.scm.provider.svn.svnexe.command.tag.SvnTagCommand;
+import org.apache.maven.scm.provider.svn.svnexe.command.untag.SvnUntagCommand;
import org.apache.maven.scm.provider.svn.svnexe.command.update.SvnUpdateCommand;
import org.apache.maven.scm.repository.ScmRepositoryException;
@@ -138,6 +139,14 @@
/**
* {@inheritDoc}
*/
+ protected SvnCommand getUntagCommand()
+ {
+ return new SvnUntagCommand();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
protected SvnCommand getUpdateCommand()
{
return new SvnUpdateCommand();
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnUntagCommand.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnUntagCommand.java
new file mode 100644
index 0000000..de49edc
--- /dev/null
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnUntagCommand.java
@@ -0,0 +1,153 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.untag;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 java.io.File;
+import java.io.IOException;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmTag;
+import org.apache.maven.scm.ScmUntagParameters;
+import org.apache.maven.scm.command.untag.AbstractUntagCommand;
+import org.apache.maven.scm.command.untag.UntagScmResult;
+import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.SvnCommandUtils;
+import org.apache.maven.scm.provider.svn.SvnTagBranchUtils;
+import org.apache.maven.scm.provider.svn.command.SvnCommand;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.Os;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+/**
+ * scm:untag for provider svn is done by removing the tag dir
+ *
+ * @since 1.11.2
+ */
+public class SvnUntagCommand extends AbstractUntagCommand implements SvnCommand
+{
+
+ /** {@inheritDoc} */
+ @Override
+ public ScmResult executeUntagCommand( ScmProviderRepository repo, ScmFileSet fileSet,
+ ScmUntagParameters scmUntagParameters ) throws ScmException
+ {
+ String tag = scmUntagParameters.getTag();
+ if ( tag == null || tag.trim().isEmpty() )
+ {
+ throw new ScmException( "tag must be specified" );
+ }
+
+ SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;
+
+ File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );
+
+ String message = scmUntagParameters.getMessage();
+ try
+ {
+ FileUtils.fileWrite( messageFile.getAbsolutePath(), "UTF-8", message );
+ }
+ catch ( IOException ex )
+ {
+ return new UntagScmResult( null, "Error while making a temporary file for the commit message: "
+ + ex.getMessage(), null, false );
+ }
+
+ Commandline cl = createCommandline( repository, fileSet, tag, messageFile );
+
+ CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
+
+ CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+ if ( getLogger().isInfoEnabled() )
+ {
+ getLogger().info( "Executing: " + SvnCommandLineUtils.cryptPassword( cl ) );
+
+ if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
+ {
+ getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
+ }
+ }
+
+ int exitCode;
+
+ try
+ {
+ exitCode = SvnCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
+ }
+ catch ( CommandLineException ex )
+ {
+ throw new ScmException( "Error while executing svn remove command.", ex );
+ }
+ finally
+ {
+ try
+ {
+ FileUtils.forceDelete( messageFile );
+ }
+ catch ( IOException ex )
+ {
+ // ignore
+ }
+ }
+
+ if ( exitCode == 0 )
+ {
+ return new UntagScmResult( cl.toString(), "The svn remove command was successful.",
+ stderr.getOutput(), true );
+ }
+ else
+ {
+ return new UntagScmResult( cl.toString(), "The svn remove command failed.", stderr.getOutput(), false );
+ }
+
+ }
+
+ /**
+ * create command line from parameters
+ *
+ * @param repo svn repo tu delete tag from
+ * @param fileSet file set containing base dir
+ * @param tag tag to delete
+ * @param messageFile file containing commit message
+ * @return command line instance
+ */
+ Commandline createCommandline( SvnScmProviderRepository repo, ScmFileSet fileSet, String tag, File messageFile )
+ {
+ Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( fileSet.getBasedir(), repo );
+
+ cl.createArg().setValue( "--file" );
+
+ cl.createArg().setValue( messageFile.getAbsolutePath() );
+
+ cl.createArg().setValue( "remove" );
+
+ String tagUrl = SvnTagBranchUtils.resolveTagUrl( repo, new ScmTag( tag ) );
+ tagUrl = SvnCommandUtils.fixUrl( tagUrl, repo.getUser() );
+ cl.createArg().setValue( tagUrl + "@" );
+
+ return cl;
+ }
+
+}
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnExeUntagCommandTckTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnExeUntagCommandTckTest.java
new file mode 100644
index 0000000..8dc0f69
--- /dev/null
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnExeUntagCommandTckTest.java
@@ -0,0 +1,100 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.untag;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 java.io.File;
+import org.apache.maven.scm.ScmFileSet;
+
+import org.apache.maven.scm.provider.svn.command.untag.SvnUntagCommandTckTest;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.codehaus.plexus.util.cli.Commandline;
+
+/**
+ * This test tests the untag command for Subversion.
+ *
+ */
+public class SvnExeUntagCommandTckTest
+ extends SvnUntagCommandTckTest
+{
+ /**
+ * test against ssh repository with user
+ *
+ * @throws Exception in case of error
+ */
+ public void testUntagSsh()
+ throws Exception
+ {
+ File messageFile = File.createTempFile( "maven-scm", "commit" );
+ messageFile.deleteOnExit();
+
+ ScmFileSet scmFileSet = new ScmFileSet( new File ( "target/svn-untag-command-test" ) );
+
+ testCommandLine( "scm:svn:svn+ssh://foo.com/svn/trunk", scmFileSet, "svntag", messageFile,
+ "user", "svn --username user --no-auth-cache --non-interactive --file "
+ + messageFile.getAbsolutePath() + " remove svn+ssh://user@foo.com/svn/tags/svntag@" );
+ }
+
+ /**
+ * test against https repository with user
+ *
+ * @throws Exception in case of error
+ */
+ public void testUntagHttps()
+ throws Exception
+ {
+ File messageFile = File.createTempFile( "maven-scm", "commit" );
+ messageFile.deleteOnExit();
+
+ ScmFileSet scmFileSet = new ScmFileSet( new File ( "target/svn-untag-command-test" ) );
+
+ testCommandLine( "scm:svn:https://foo.com/svn/tags", scmFileSet, "svntag", messageFile,
+ "user", "svn --username user --no-auth-cache --non-interactive --file "
+ + messageFile.getAbsolutePath() + " remove https://foo.com/svn/tags/svntag@" );
+ }
+
+ /**
+ * test routine, build command line and assert
+ *
+ * @param scmUrl url to svn repo
+ * @param scmFileSet file set for local dir
+ * @param tag tag to delete
+ * @param messageFile file containing commit message
+ * @param user user to acces the repo with
+ * @param commandLine set command line for comparison
+ * @throws Exception in case of error
+ */
+ private void testCommandLine( String scmUrl, ScmFileSet scmFileSet, String tag, File messageFile, String user,
+ String commandLine )
+ throws Exception
+ {
+ File workingDirectory = getTestFile( "target/svn-untag-command-test" );
+
+ ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
+
+ SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
+
+ svnRepository.setUser( user );
+
+ Commandline cl = new SvnUntagCommand().createCommandline( svnRepository, scmFileSet, tag, messageFile );
+
+ assertCommandLine( commandLine, workingDirectory, cl );
+ }
+}
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnUntagCommandTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnUntagCommandTest.java
new file mode 100644
index 0000000..7838a0c
--- /dev/null
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/untag/SvnUntagCommandTest.java
@@ -0,0 +1,117 @@
+package org.apache.maven.scm.provider.svn.svnexe.command.untag;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.maven.scm.ScmFileSet;
+
+/**
+ * test the subversion untag implementation
+ *
+ */
+public class SvnUntagCommandTest
+ extends ScmTestCase
+{
+
+ /**
+ * test with http repo and user
+ *
+ * @throws Exception in case of error
+ */
+ public void testUntagHttp()
+ throws Exception
+ {
+
+ File messageFile = File.createTempFile( "maven-scm", "untag" );
+ messageFile.deleteOnExit();
+
+ testCommandLine( "scm:svn:http://foo.com/svn/tags", new ScmFileSet( getUntagTestFile() ), "svntag", "user",
+ messageFile, "svn --username user --no-auth-cache --non-interactive "
+ + "--file " + messageFile.getAbsolutePath() + " remove http://foo.com/svn/tags/svntag@" );
+ }
+
+ /**
+ * test with ssh repo and user
+ *
+ * @throws Exception in case of error
+ */
+ public void testUntagSsh()
+ throws Exception
+ {
+
+ File messageFile = File.createTempFile( "maven-scm", "untag" );
+ messageFile.deleteOnExit();
+
+ testCommandLine( "scm:svn:svn+ssh://foo.com/svn/tags", new ScmFileSet( getUntagTestFile() ), "svntag", "user",
+ messageFile, "svn --username user --no-auth-cache --non-interactive "
+ + "--file " + messageFile.getAbsolutePath() + " remove svn+ssh://user@foo.com/svn/tags/svntag@" );
+ }
+
+ /**
+ * define path to local dir
+ *
+ * @return local dir
+ */
+ private File getUntagTestFile()
+ {
+ return getTestFile( "target/svn-untag-command-test" );
+ }
+
+ /**
+ * get svn repo instance
+ *
+ * @param scmUrl url to svn repo
+ * @return svn repo instance
+ * @throws Exception in case of error
+ */
+ private SvnScmProviderRepository getSvnRepository( String scmUrl )
+ throws Exception
+ {
+ ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
+
+ return (SvnScmProviderRepository) repository.getProviderRepository();
+ }
+
+ /**
+ * test routine for command line
+ *
+ * @param scmUrl url to build repo instnace from
+ * @param scmFileSet file set containing local base dir
+ * @param tag tag to delete
+ * @param user svn user for repo access
+ * @param messageFile file containing commit message
+ * @param commandline set command line to compare actual to
+ * @throws Exception in case of error
+ */
+ private void testCommandLine( String scmUrl, ScmFileSet scmFileSet, String tag, String user, File messageFile,
+ String commandline ) throws Exception
+ {
+ SvnScmProviderRepository repo = getSvnRepository( scmUrl );
+ repo.setUser(user);
+ Commandline cl = new SvnUntagCommand().createCommandline( repo, scmFileSet, tag, messageFile );
+
+ assertCommandLine( commandline, scmFileSet.getBasedir(), cl );
+ }
+}
diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/untag/SvnUntagCommandTckTest.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/untag/SvnUntagCommandTckTest.java
new file mode 100644
index 0000000..c8cb9d7
--- /dev/null
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svntest/src/main/java/org/apache/maven/scm/provider/svn/command/untag/SvnUntagCommandTckTest.java
@@ -0,0 +1,49 @@
+package org.apache.maven.scm.provider.svn.command.untag;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.SvnScmTestUtils;
+import org.apache.maven.scm.tck.command.untag.UntagCommandTckTest;
+
+import java.io.File;
+
+/**
+ * This test tests the tag command.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ *
+ */
+public class SvnUntagCommandTckTest
+ extends UntagCommandTckTest
+{
+ /** {@inheritDoc} */
+ public String getScmUrl()
+ throws Exception
+ {
+ return SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(), "trunk" ) );
+ }
+
+ /** {@inheritDoc} */
+ public void initRepo()
+ throws Exception
+ {
+ SvnScmTestUtils.initializeRepository( getRepositoryRoot() );
+ }
+}
diff --git a/pom.xml b/pom.xml
index 6a3b1ca..3405fe8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -349,7 +349,8 @@
<exclude>src/test/linear-changelog/**</exclude>
<exclude>src/test/tck-repository/**</exclude>
<exclude>src/main/resources/tck/**</exclude>
- <exclude>.travis.yml </exclude>
+ <exclude>.travis.yml</exclude>
+ <exclude>nbactions.xml</exclude>
</excludes>
</configuration>
</plugin>