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 );
cvsCommand.connect( root, password );
cvsCommand.addListener( listener );
if ( logger.isDebugEnabled() )
{
logger.debug( "Executing CVS command: " + c.getCVSCommand() );
}
boolean result = cvsCommand.executeCommand( c );
cvsCommand.disconnect();
return result;
}