private static void parseOutput()

in src/net/sourceforge/transparent/CCaseUpdateEnvironment.java [92:144]


  private static void parseOutput( String contentRoot, String output, UpdatedFiles updatedFiles )
  {
    String sepSymbol = new String( new char[] { File.separatorChar } );
    HashSet<String> updated = new HashSet<>();
    HashSet<String> skipped = new HashSet<>();
    HashSet<String> deleted = new HashSet<>();

    String rootPath = contentRoot;
    if( !rootPath.endsWith( sepSymbol ) )
      rootPath += sepSymbol;

    String[] lines = LineTokenizer.tokenize( output.toCharArray(), false, true );
    for( String line : lines )
    {
      if( line.startsWith( LOADING_SIG ) )
      {
        int lastQuote = line.lastIndexOf( "\"" );
        String fileName = line.substring( LOADING_SIG.length(), lastQuote );
        updated.add( VcsUtil.getCanonicalLocalPath( fileName ) );
      }
      else
      if( line.startsWith( KEEP_HIJACKED_SIG ))
      {
        int lastQuote = line.lastIndexOf( BASE_DELIM );
        String fileName = line.substring( KEEP_HIJACKED_SIG.length(), lastQuote - 1 );
        skipped.add( VcsUtil.getCanonicalLocalPath( fileName ) );
      }
      else
      if( line.startsWith( UNLOADED_SIG ) )
      {
        String fileName = line.substring( UNLOADED_SIG.length(), line.length() - 2 );
        deleted.add( VcsUtil.getCanonicalLocalPath( fileName ) );
      }
      else
      if( line.startsWith( VIEW_BASE_PATH_SIG ) )
      {
        int updateFileStart = line.lastIndexOf( UPDATE_FILE_PREFIX_SIG );
        if( updateFileStart != -1 )
        {
          line = line.substring( 0, updateFileStart );
          rootPath = line.substring( VIEW_BASE_PATH_SIG.length() + 2 );
        }
      }
    }

    final VcsKey vcsKey = TransparentVcs.getKey();
    for( String path : updated )
      updatedFiles.getGroupById( FileGroup.UPDATED_ID ).add(rootPath + path, vcsKey, null);
    for( String path : skipped )
      updatedFiles.getGroupById( FileGroup.SKIPPED_ID ).add(rootPath + path, vcsKey, null);
    for( String path : deleted )
      updatedFiles.getGroupById( FileGroup.REMOVED_FROM_REPOSITORY_ID ).add(rootPath + path, vcsKey, null);
  }