Skip to content
Commits on Source (3)
......@@ -9,5 +9,6 @@ target
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
maven-scm (1.11.2-1) unstable; urgency=medium
* Team upload.
* New upstream release
-- Emmanuel Bourg <ebourg@apache.org> Sun, 07 Jul 2019 14:09:09 +0200
maven-scm (1.11.1-1) unstable; urgency=medium
* Team upload.
......
......@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm</artifactId>
<version>1.11.1</version>
<version>1.11.2</version>
</parent>
<artifactId>maven-scm-api</artifactId>
......
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 + "]";
}
}
package org.apache.maven.scm.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.CommandParameter;
import org.apache.maven.scm.CommandParameters;
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;
/** {@inheritDoc} */
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, 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, scmUntagParameters );
}
}
package org.apache.maven.scm.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.ScmResult;
/** {@inheritDoc} */
public class UntagScmResult
extends ScmResult
{
private static final long serialVersionUID = -5068975000282095635L;
public UntagScmResult( String commandLine, String providerMessage, String commandOutput, boolean success )
{
super( commandLine, providerMessage, commandOutput, success );
}
public UntagScmResult( String commandLine )
{
super( commandLine, null, null, true );
}
public UntagScmResult( ScmResult result )
{
super( result );
}
}
......@@ -49,6 +49,7 @@
import org.apache.maven.scm.command.status.StatusScmResult;
import org.apache.maven.scm.command.tag.TagScmResult;
import org.apache.maven.scm.command.unedit.UnEditScmResult;
import org.apache.maven.scm.command.untag.UntagScmResult;
import org.apache.maven.scm.command.update.UpdateScmResult;
import org.apache.maven.scm.log.ScmLogDispatcher;
import org.apache.maven.scm.log.ScmLogger;
......@@ -899,6 +900,17 @@ protected UnEditScmResult unedit( ScmProviderRepository repository, ScmFileSet f
return new UnEditScmResult( "", null, null, true );
}
/**
* {@inheritDoc}
*/
public UntagScmResult untag( ScmRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
getLogger().warn( "Provider " + this.getScmType() + " does not support untag operation." );
return new UntagScmResult( "", null, null, true );
}
/**
* {@inheritDoc}
*
......
......@@ -45,6 +45,7 @@
import org.apache.maven.scm.command.status.StatusScmResult;
import org.apache.maven.scm.command.tag.TagScmResult;
import org.apache.maven.scm.command.unedit.UnEditScmResult;
import org.apache.maven.scm.command.untag.UntagScmResult;
import org.apache.maven.scm.command.update.UpdateScmResult;
import org.apache.maven.scm.log.ScmLogger;
import org.apache.maven.scm.repository.ScmRepository;
......@@ -641,6 +642,18 @@ StatusScmResult status( ScmRepository repository, ScmFileSet fileSet )
TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName )
throws ScmException;
/**
* Deletes a tag.
*
* @param repository the source control system
* @param fileSet a fileset with the relevant working directory as basedir
* @param parameters
* @return
* @throws ScmException if any
*/
UntagScmResult untag( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException;
/**
* Tag (or label in some systems) will tag the source file with a certain tag
*
......
......@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm</artifactId>
<version>1.11.1</version>
<version>1.11.2</version>
</parent>
<artifactId>maven-scm-client</artifactId>
......
......@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-managers</artifactId>
<version>1.11.1</version>
<version>1.11.2</version>
</parent>
<artifactId>maven-scm-manager-plexus</artifactId>
......
......@@ -23,7 +23,7 @@
<parent>
<artifactId>maven-scm</artifactId>
<groupId>org.apache.maven.scm</groupId>
<version>1.11.1</version>
<version>1.11.2</version>
</parent>
<artifactId>maven-scm-managers</artifactId>
......
......@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm</artifactId>
<version>1.11.1</version>
<version>1.11.2</version>
</parent>
<!--
......@@ -128,6 +128,11 @@
<artifactId>maven-scm-provider-svntest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gittest</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
......
package org.apache.maven.scm.plugin;
/*
* 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.IOException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.scm.CommandParameter;
import org.apache.maven.scm.CommandParameters;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.command.untag.UntagScmResult;
import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.repository.ScmRepository;
/**
* Untag the project.
*/
@Mojo( name = "untag", aggregator = true )
public class UntagMojo
extends AbstractScmMojo
{
/**
* The tag name.
*/
@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
{
super.execute();
try
{
ScmRepository repository = getScmRepository();
ScmProvider provider = getScmManager().getProviderByRepository( repository );
String finalTag = provider.sanitizeTagName( tag );
getLog().info( "Final Tag Name: '" + finalTag + "'" );
CommandParameters parameters = new CommandParameters();
parameters.setString( CommandParameter.TAG_NAME, finalTag );
parameters.setString( CommandParameter.MESSAGE, message );
UntagScmResult result = provider.untag( repository, getFileSet(), parameters );
checkResult( result );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Cannot run untag command", e );
}
catch ( ScmException e )
{
throw new MojoExecutionException( "Cannot run untag command", e );
}
}
}
......@@ -25,6 +25,7 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.scm.provider.svn.AbstractSvnScmProvider;
import java.util.Iterator;
import java.util.List;
......@@ -56,12 +57,11 @@ public class ValidateMojo
private String scmDeveloperConnection;
/**
* <em>(Subversion specific)</em> Enables checking that "URL" field returned by svn info matches what is specified
* under the scm tag.
* <em>(Subversion specific)</em> Enables checking that "URL" field returned by 'svn info' matches what is
* specified under the scm tag.
* @see AbstractSvnScmProvider#CURRENT_WORKING_DIRECTORY
*/
@Parameter( property = "scmCheckWorkingDirectoryUrl", defaultValue = "false" )
// Actually unused in the code here. Present for doc purpose,
// see org.apache.maven.scm.provider.svn.AbstractSvnScmProvider.CHECK_WORKING_DIRECTORY_URL
private boolean scmCheckWorkingDirectoryUrl;
/**
......@@ -101,7 +101,7 @@ private void validateConnection( String connectionString, String type )
{
if ( scmCheckWorkingDirectoryUrl )
{
System.setProperty( "scmCheckWorkingDirectoryUrl.currentWorkingDirectory",
System.setProperty( AbstractSvnScmProvider.CURRENT_WORKING_DIRECTORY,
project.getFile().getParentFile().getAbsolutePath() );
}
List<String> messages = getScmManager().validateScmRepository( connectionString );
......
package org.apache.maven.scm.plugin;
/*
* 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.plugin.MojoExecutionException;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.scm.provider.git.GitScmTestUtils;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
public class UntagMojoTest
extends AbstractMojoTestCase
{
File checkoutDir;
File repository;
protected void setUp()
throws Exception
{
super.setUp();
checkoutDir = getTestFile( "target/checkout" );
repository = getTestFile( "target/repository" );
GitScmTestUtils.initRepo( "src/test/resources/git", repository, checkoutDir );
CheckoutMojo checkoutMojo = (CheckoutMojo) lookupMojo( "checkout", getTestFile(
"src/test/resources/mojos/untag/checkout.xml" ) );
checkoutMojo.setWorkingDirectory( checkoutDir );
String connectionUrl = checkoutMojo.getConnectionUrl();
connectionUrl = StringUtils.replace( connectionUrl, "${basedir}", getBasedir() );
connectionUrl = StringUtils.replace( connectionUrl, "\\", "/" );
checkoutMojo.setConnectionUrl( connectionUrl );
checkoutMojo.setCheckoutDirectory( checkoutDir );
checkoutMojo.execute();
// Add a default user to the config
GitScmTestUtils.setDefaultUser( checkoutDir );
}
public void testUntag()
throws Exception
{
TagMojo tagMojo = (TagMojo) lookupMojo( "tag", getTestFile( "src/test/resources/mojos/untag/tag.xml" ) );
tagMojo.setWorkingDirectory( checkoutDir );
tagMojo.setConnectionUrl( getConnectionLocalAddress( tagMojo ) );
tagMojo.execute();
CheckoutMojo checkoutMojo =
(CheckoutMojo) lookupMojo( "checkout", getTestFile( "src/test/resources/mojos/untag/checkout-tag.xml" ) );
checkoutMojo.setWorkingDirectory( new File( getBasedir() ) );
checkoutMojo.setConnectionUrl( getConnectionLocalAddress( checkoutMojo ) );
File tagCheckoutDir = getTestFile( "target/tags/mytag" );
if ( tagCheckoutDir.exists() )
{
FileUtils.deleteDirectory( tagCheckoutDir );
}
checkoutMojo.setCheckoutDirectory( tagCheckoutDir );
checkoutMojo.execute();
UntagMojo mojo = (UntagMojo) lookupMojo( "untag", getTestFile( "src/test/resources/mojos/untag/untag.xml" ) );
mojo.setWorkingDirectory( checkoutDir );
mojo.setConnectionUrl( getConnectionLocalAddress( mojo ) );
mojo.execute();
FileUtils.deleteDirectory( tagCheckoutDir );
try
{
checkoutMojo.execute();
fail( "mojo execution must fail." );
}
catch ( MojoExecutionException e )
{
assertTrue( true );
}
}
private String getConnectionLocalAddress( AbstractScmMojo mojo )
{
String connectionUrl = mojo.getConnectionUrl();
connectionUrl = StringUtils.replace( connectionUrl, "${basedir}", getBasedir() );
connectionUrl = StringUtils.replace( connectionUrl, "\\", "/" );
return connectionUrl;
}
}
[core]
repositoryformatversion = 0
filemode = true
bare = true
ignorecase = true
Unnamed repository; edit this file to name it for gitweb.