You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@apache.org on 2004/07/09 13:53:46 UTC

cvs commit: maven-plugins/changelog/src/main/org/apache/maven/cvslib CvsConnection.java

dion        2004/07/09 04:53:46

  Modified:    changelog project.xml
               changelog/xdocs changes.xml
               changelog/src/main/org/apache/maven/cvslib
                        CvsConnection.java
  Added:       changelog/src/test/org/apache/maven/cvslib
                        CvsConnectionTest.java
  Log:
  Fix for MPCHANGELOG-34.
  Plugin does not find the password for the CVSROOT in .cvspass if the CVSROOT in .cvspass is preceded by a "/1".
  
  Revision  Changes    Path
  1.3       +65 -84    maven-plugins/changelog/src/test/org/apache/maven/cvslib/CvsConnectionTest.java
  
  
  
  
  1.47      +1 -1      maven-plugins/changelog/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/changelog/project.xml,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- project.xml	8 Jul 2004 15:34:54 -0000	1.46
  +++ project.xml	9 Jul 2004 11:53:46 -0000	1.47
  @@ -23,7 +23,7 @@
     <pomVersion>3</pomVersion>
     <id>maven-changelog-plugin</id>
     <name>Maven Changelog Plugin</name>
  -  <currentVersion>1.7</currentVersion>
  +  <currentVersion>1.7.1-SNAPSHOT</currentVersion>
     <description/>
     <shortDescription>Produce SCM changelog reports</shortDescription>
     <url>http://maven.apache.org/reference/plugins/changelog/</url>
  
  
  
  1.38      +3 -0      maven-plugins/changelog/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/changelog/xdocs/changes.xml,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- changes.xml	8 Jul 2004 15:34:54 -0000	1.37
  +++ changes.xml	9 Jul 2004 11:53:46 -0000	1.38
  @@ -25,6 +25,9 @@
       <author email="evenisse@ifrance.com">Emmanuel Venisse</author>
     </properties>
     <body>
  +    <release version="1.7.1-SNAPSHOT" date="in CVS">
  +      <action dev="dion" type="fix" issue="MPCHANGELOG-34" due-to="Saito Kazuo">Plugin does not find the password for the CVSROOT in .cvspass if the CVSROOT in .cvspass is preceded by a "/1".</action>
  +    </release>
       <release version="1.7" date="2004-07-08">
         <action dev="evenisse" type="fix">Add the possibility to specify a date format for input stream (Starteam only).</action>
       </release>
  
  
  
  1.9       +48 -1     maven-plugins/changelog/src/main/org/apache/maven/cvslib/CvsConnection.java
  
  Index: CvsConnection.java
  ===================================================================
  RCS file: /home/cvs/maven-plugins/changelog/src/main/org/apache/maven/cvslib/CvsConnection.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CvsConnection.java	28 Apr 2004 04:11:38 -0000	1.8
  +++ CvsConnection.java	9 Jul 2004 11:53:46 -0000	1.9
  @@ -21,9 +21,11 @@
   import java.io.File;
   import java.io.FileReader;
   import java.io.IOException;
  +import java.util.Vector;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.tools.ant.util.StringUtils;
   import org.netbeans.lib.cvsclient.CVSRoot;
   import org.netbeans.lib.cvsclient.Client;
   import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
  @@ -226,11 +228,24 @@
   
           try
           {
  +        	StringBuffer cvsroot = new StringBuffer();
  +        	
               reader = new BufferedReader(new FileReader(passFile));
               String line;
               while ((line = reader.readLine()) != null)
               {
  -                if (line.startsWith(cvsRoot))
  +            	if (line.startsWith("/"))
  +            	{
  +                	Vector cvspass = StringUtils.split(line, ' ');
  +            		if (cvspass.size() >= 3)
  +            		{
  +            			if (compareCvsRoot(cvsRoot, (String)cvspass.get(1))) {
  +            				password = (String)cvspass.get(2);
  +            				break;
  +            			}
  +            		}
  +            	}
  +            	else if (line.startsWith(cvsRoot))
                   {
                       password = line.substring(cvsRoot.length() + 1);
                       break;
  @@ -263,6 +278,38 @@
           return password;
       }
   
  +    static boolean compareCvsRoot(String cvsRoot, String target)
  +    {
  +    	String s1 = completeCvsRootPort(cvsRoot);
  +    	String s2 = completeCvsRootPort(target);
  +    	if (s1 != null && s1.equals(s2))
  +    	{
  +    		return true;
  +    	}
  +    	return false;
  +    	
  +    }
  +    
  +    private static String completeCvsRootPort(String cvsRoot)
  +    {
  +    	String result = cvsRoot;
  +    	int idx = cvsRoot.indexOf(':');
  +    	for (int i=0; i < 2 && idx != -1; i++)
  +    	{
  +    		idx = cvsRoot.indexOf(':', idx+1);
  +    	}
  +    	if (idx != -1 && cvsRoot.charAt(idx+1) == '/') 
  +    	{
  +    		StringBuffer sb = new StringBuffer();
  +    		sb.append(cvsRoot.substring(0, idx+1));
  +    		sb.append("2401");
  +    		sb.append(cvsRoot.substring(idx+1));
  +    		result = sb.toString();
  +    	}
  +    	return result;
  +
  +    }
  +    
       /**
   	 * Process the CVS command passed in args[] array with all necessary
   	 * options. The only difference from main() method is, that this method
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org