Makes sure non-SVN projects don't have their connection strings rewritten after a release

http://jira.codehaus.org/browse/MRELEASE-114
http://jira.codehaus.org/browse/MRELEASE-128
http://jira.codehaus.org/browse/MRELEASE-16


Index: src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhaseTest.java
===================================================================
--- src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhaseTest.java	(revision 441135)
+++ src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhaseTest.java	(working copy)
@@ -248,7 +248,28 @@
 
         assertTrue( compareFiles( config.getReactorProjects() ) );
     }
+    
+    public void testRewriteBasicPomWithCvsFromTagVariableRewrite()
+    throws Exception
+    {
+        ReleaseConfiguration config = createConfigurationFromProjects( "basic-pom-with-cvs-from-tag" );
+        mapNextVersion( config, "groupId:artifactId" );
+        
+        //in real life, by the time we get here our project is 
+        //probably going to evaluated with 
+        //${username} replaced with SOMEONESUSERNAME
+        Scm scm = new Scm();
+        scm.setConnection( "scm:cvs:pserver:anoncvs@localhost:/tmp/scm-repo:module" );
+        scm.setDeveloperConnection( "scm:cvs:ext:SOMEONESUSERNAME@localhost:/tmp/scm-repo:module" );
+        scm.setUrl( "http://localhost/viewcvs.cgi/module" );
+        scm.setTag( "original-label" );
+        config.mapOriginalScmInfo( "groupId:artifactId", scm );
+        
+        phase.execute( config );
 
+        assertTrue( compareFiles( config.getReactorProjects() ) );
+    }    
+
     public void testRewriteBasicPomWithInheritedScm()
         throws Exception
     {
Index: src/main/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhase.java
===================================================================
--- src/main/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhase.java	(revision 441135)
+++ src/main/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhase.java	(working copy)
@@ -66,8 +66,15 @@
 
                     if ( scm != null )
                     {
-                        rewriteElement( "connection", scm.getConnection(), scmRoot, namespace );
-                        rewriteElement( "developerConnection", scm.getDeveloperConnection(), scmRoot, namespace );
+                        //as far as I know, only subversion needs this rewrite
+                        //and for CVS it removes the username variables
+                        //which isn't desired
+                        if (scm.getConnection() != null && scm.getConnection().startsWith("scm:svn:")) {
+                          rewriteElement( "connection", scm.getConnection(), scmRoot, namespace );
+                        }
+                        if (scm.getDeveloperConnection() != null && scm.getDeveloperConnection().startsWith("scm:svn:")) {
+                          rewriteElement( "developerConnection", scm.getDeveloperConnection(), scmRoot, namespace );
+                        }
                         rewriteElement( "url", scm.getUrl(), scmRoot, namespace );
                         rewriteElement( "tag", translator.resolveTag( scm.getTag() ), scmRoot, namespace );
                     }


