}
return false;
}
// parse the CVS root into its constituent parts
CVSRoot root;
final String cvsRoot = globalOptions.getCVSRoot();
try
{
root = CVSRoot.parse( cvsRoot );
}
catch ( IllegalArgumentException e )
{
if ( logger.isErrorEnabled() )
{
logger.error( "Incorrect format for CVSRoot: " + cvsRoot + "\nThe correct format is: "
+ "[:method:][[user][:password]@][hostname:[port]]/path/to/repository"
+ "\nwhere \"method\" is pserver." );
}
return false;
}
final String command = args[commandIndex];
// this is not login, but a 'real' cvs command, so construct it,
// set the options, and then connect to the server and execute it
Command c;
try
{
c = CommandFactory.getDefault().createCommand( command, args, ++commandIndex, globalOptions, localPath );
}
catch ( IllegalArgumentException e )
{
if ( logger.isErrorEnabled() )
{
logger.error( "Illegal argument: " + e.getMessage() );
}
return false;
}
String password = null;
if ( CVSRoot.METHOD_PSERVER.equals( root.getMethod() ) )
{
password = root.getPassword();
if ( password != null )
{
password = StandardScrambler.getInstance().scramble( password );
}
else
{
password = lookupPassword( cvsRoot, logger );
if ( password == null )
{
password = StandardScrambler.getInstance().scramble( "" );
// an empty password
}
}
}
CvsConnection cvsCommand = new CvsConnection();
cvsCommand.setGlobalOptions( globalOptions );
cvsCommand.setRepository( root.getRepository() );
// the local path is just the path where we executed the
// command. This is the case for command-line CVS but not
// usually for GUI front-ends
cvsCommand.setLocalPath( localPath );