Repository: maven-scm Updated Branches: refs/heads/master 3aab5fda6 -> 7e41fe27c
http://git-wip-us.apache.org/repos/asf/maven-scm/blob/fc391437/maven-scm-plugin/src/it/scm-781/prepare.groovy ---------------------------------------------------------------------- diff --git a/maven-scm-plugin/src/it/scm-781/prepare.groovy b/maven-scm-plugin/src/it/scm-781/prepare.groovy new file mode 100644 index 0000000..f774c45 --- /dev/null +++ b/maven-scm-plugin/src/it/scm-781/prepare.groovy @@ -0,0 +1,52 @@ +/* + * 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. + */ + +// We rename the dotSvnDir in the IT folder to standard .svn naming so that the IT can execute. +// BUT we actually don't store that special versioning directory as-is to prevent potentially confusing +// (to say the least) a svn checkout of the maven-scm project. +// + +File dotSvnDir = new File( basedir, 'dotSvnDir' ) +assert dotSvnDir.exists() +assert dotSvnDir.isDirectory() +assert dotSvnDir.renameTo( new File( basedir, '.svn' ) ) + +dotSvnDir = new File( basedir, 'asf/dotSvnDir' ) +assert dotSvnDir.exists() +assert dotSvnDir.isDirectory() +assert dotSvnDir.renameTo( new File( basedir, 'asf/.svn' ) ) + +dotSvnDir = new File( basedir, 'maven/dotSvnDir' ) +assert dotSvnDir.exists() +assert dotSvnDir.isDirectory() +assert dotSvnDir.renameTo( new File( basedir, 'maven/.svn' ) ) + +println "svn --version" +def proc = "svn --version".execute() +proc.waitFor() +println "return code: ${ proc.exitValue()}" +println "stderr: ${proc.err.text}" +println "stdout: ${proc.in.text}" + +println "svn upgrade $basedir" +proc = ["svn", "upgrade", "$basedir"].execute() +proc.waitFor() +println "return code: ${ proc.exitValue()}" +println "stderr: ${proc.err.text}" +println "stdout: ${proc.in.text}" http://git-wip-us.apache.org/repos/asf/maven-scm/blob/fc391437/maven-scm-plugin/src/it/scm-781/verify.groovy ---------------------------------------------------------------------- diff --git a/maven-scm-plugin/src/it/scm-781/verify.groovy b/maven-scm-plugin/src/it/scm-781/verify.groovy new file mode 100644 index 0000000..8c786e0 --- /dev/null +++ b/maven-scm-plugin/src/it/scm-781/verify.groovy @@ -0,0 +1,20 @@ +/* + * 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. + */ +File buildLog = new File(basedir, 'build.log') +assert buildLog.exists() http://git-wip-us.apache.org/repos/asf/maven-scm/blob/fc391437/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateMojo.java ---------------------------------------------------------------------- diff --git a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateMojo.java b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateMojo.java index 0533d59..16e2c0b 100644 --- a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateMojo.java +++ b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateMojo.java @@ -27,6 +27,7 @@ import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; /** * Validate scm connection string. @@ -45,6 +46,9 @@ public class ValidateMojo @Parameter( property = "scmConnection", defaultValue = "${project.scm.connection}" ) private String scmConnection; + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject project; + /** * The scm connection url for developers. */ @@ -93,6 +97,11 @@ public class ValidateMojo private void validateConnection( String connectionString, String type ) throws MojoExecutionException { + if ( scmCheckWorkingDirectoryUrl ) + { + System.setProperty( "scmCheckWorkingDirectoryUrl.currentWorkingDirectory", + project.getFile().getParentFile().getAbsolutePath() ); + } List<String> messages = getScmManager().validateScmRepository( connectionString ); if ( !messages.isEmpty() ) http://git-wip-us.apache.org/repos/asf/maven-scm/blob/fc391437/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateRecursively.java ---------------------------------------------------------------------- diff --git a/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateRecursively.java b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateRecursively.java new file mode 100644 index 0000000..2dc4f73 --- /dev/null +++ b/maven-scm-plugin/src/main/java/org/apache/maven/scm/plugin/ValidateRecursively.java @@ -0,0 +1,30 @@ +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 org.apache.maven.plugins.annotations.Execute; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + +@Mojo( name = "validate-recursively", requiresProject = true ) +@Execute(phase = LifecyclePhase.VALIDATE) +public class ValidateRecursively extends ValidateMojo +{ +} http://git-wip-us.apache.org/repos/asf/maven-scm/blob/fc391437/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svn-commons/src/main/java/org/apache/maven/scm/provider/svn/AbstractSvnScmProvider.java ---------------------------------------------------------------------- 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 16ab2f1..013afad 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 @@ -99,12 +99,16 @@ public abstract class AbstractSvnScmProvider getLogger().debug( "Checking svn info 'URL:' field matches current sources directory" ); try { + String workingDir = System.getProperty( "scmCheckWorkingDirectoryUrl.currentWorkingDirectory" ); InfoScmResult info = - info( result.repository, new ScmFileSet( new File( "." ) ), new CommandParameters() ); + info( result.repository, new ScmFileSet( new File( workingDir ) ), new CommandParameters() ); + String url = findUrlInfoItem( info ); + String comparison = "'" + url + "' vs. '" + scmSpecificUrl + "'"; + getLogger().debug( "Comparing : " + comparison ); if ( url != null && !url.equals( scmSpecificUrl ) ) { - result.messages.add( "The scm url does not match the value returned by svn info" ); + result.messages.add( "Scm url does not match the value returned by svn info (" + comparison + ")" ); } } catch ( ScmException e ) @@ -136,6 +140,7 @@ public abstract class AbstractSvnScmProvider return infoItem.getURL(); } } + getLogger().debug( "URL not found (command output=" + infoScmResult.getCommandOutput() + ")" ); return null; }
