CvsScmProviderRepository returns wrong CVSROOT for local repository -------------------------------------------------------------------
Key: SCM-387 URL: http://jira.codehaus.org/browse/SCM-387 Project: Maven SCM Issue Type: Bug Components: maven-scm-provider-cvs Affects Versions: 1.1 Reporter: Sergey Zakusov Priority: Blocker For local repository getCvsRoot() returns just the root path without transport type - see getCvsRootForCvsPass: {code:title=CvsScmProviderRepository.java|borderStyle=solid} /** * @return The cvs root */ public String getCvsRoot() { String root = getCvsRootForCvsPass(); return removeDefaultPortFromCvsRoot( root ); } private String removeDefaultPortFromCvsRoot( String root ) { if ( root != null && root.indexOf( ":2401" ) > 0 ) { root = root.substring( 0, root.indexOf( ":2401" ) ) + ":" + root.substring( root.indexOf( ":2401" ) + 5 ); } return root; } /** * @return The cvs root stored in .cvspass */ public String getCvsRootForCvsPass() { if ( getUser() != null ) { return getCvsRootWithCorrectUser( getUser() ); } else { if ( AbstractCvsScmProvider.TRANSPORT_LOCAL.equals( getTransport() ) ) { return cvsroot; } else { throw new IllegalArgumentException( "Username isn't defined." ); } } } /** * @param user user name * @return */ private String getCvsRootWithCorrectUser( String user ) { //:transport:rest_of_cvsroot int indexOfUsername = getTransport().length() + 2; int indexOfAt = cvsroot.indexOf( "@" ); String userString = user == null ? "" : ":" + user; if ( indexOfAt > 0 ) { cvsroot = ":" + getTransport() + userString + cvsroot.substring( indexOfAt ); } else { cvsroot = ":" + getTransport() + userString + "@" + cvsroot.substring( indexOfUsername ); } return cvsroot; } {code} And if user was set directly, then the getCvsRootWithCorrectUser logic will be wrong. So the method should be changed like: {code:title=CvsScmProviderRepository.java|borderStyle=solid} /** * @return The cvs root stored in .cvspass */ public String getCvsRootForCvsPass() { String result; String transport = getTransport(); if ( AbstractCvsScmProvider.TRANSPORT_LOCAL.equals( transport ) ) { result = ":" + transport + ":" + cvsroot; } else if ( getUser() != null ) { result = getCvsRootWithCorrectUser( getUser() ); } else { throw new IllegalArgumentException( "Username isn't defined." ); } return result; } {code} -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira