You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Vincent Siveton (JIRA)" <ji...@codehaus.org> on 2008/08/19 12:56:26 UTC
[jira] Closed: (SCM-387) CvsScmProviderRepository returns wrong
CVSROOT for local repository
[ http://jira.codehaus.org/browse/SCM-387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vincent Siveton closed SCM-387.
-------------------------------
Assignee: Vincent Siveton
Resolution: Fixed
Fix Version/s: 1.1
Patch applied in [r687016|http://svn.apache.org/viewvc?rev=687016&view=rev]
> 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
> Assignee: Vincent Siveton
> Priority: Blocker
> Fix For: 1.1
>
>
> 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