in src/net/sourceforge/transparent/TransparentVcs.java [832:873]
public void changeActivityForLastVersion( FilePath file, String srcActivity, String dstActivity,
List<VcsException> errors )
{
CCaseViewsManager viewsMgr = CCaseViewsManager.getInstance( myProject );
VirtualFile root = VcsUtil.getVcsRootFor( myProject, file );
// First get the proper version of the checked out element.
String output = cleartoolOnLocalPathWithOutput( root.getPath(), "lshistory", "-short", file.getPath() );
String[] lines = LineTokenizer.tokenize( output, false );
if( lines.length > 0 )
{
String version = lines[ 0 ];
srcActivity = viewsMgr.getActivityIdName( srcActivity );
String dstActivityNorm = viewsMgr.getActivityIdName( dstActivity );
@NonNls Runner runner = new Runner();
runner.workingDir = root.getPath();
runner.run( new String[] { CLEARTOOL_CMD, "lsact", "-short", dstActivityNorm }, true );
if( !runner.isSuccessfull() )
{
runner.run( new String[] { CLEARTOOL_CMD, "mkact", "-nc", "-f", "-headline", "\"" + dstActivity + "\"", dstActivityNorm }, true );
if( !runner.isSuccessfull() )
{
@NonNls String msg = "Error occured while creating an activity (possibly illegal activity name). File(s) is checked to the default activity." +
"Error description: " + runner.getOutput();
errors.add( new VcsException( msg ));
return;
}
}
runner.run( new String[] { CLEARTOOL_CMD, CHANGE_ACTIVITY_CMD, "-nc", "-fcset", srcActivity,
"-tcset", dstActivityNorm, CommandLineClearCase.quote(version) }, true );
if( !runner.isSuccessfull() )
{
errors.add( new VcsException( runner.getOutput() ));
}
}
else
{
errors.add( new VcsException( "Did not manage to retrieve the element version for Activity movement." ));
}
}