public static void historyGetter()

in src/net/sourceforge/transparent/History/CCaseHistoryProvider.java [164:207]


  public static void historyGetter(final Project project, final FilePath filePath, final int maxCnt,
                                   final Consumer<CCaseHistoryParser.SubmissionData> consumer) throws VcsException {
    final TransparentVcs host = TransparentVcs.getInstance(project);
    String log;
    String path = filePath.getPath();
    if(host.renamedFiles.containsKey( path ) )
      path = host.renamedFiles.get( path );

    //  Cleartool can not handle history for hijacked files. Thus we have to
    //  construct "versioned" path, which directly points to the vob-object.
    VirtualFile vfile = filePath.getVirtualFile();
    if( vfile != null )
    {
      FileStatus status = FileStatusManager.getInstance( project ).getStatus( vfile );
      if( status == FileStatus.HIJACKED )
      {
        path += "@@";
      }
    }

    final List<String> commandParts = new ArrayList<>();
    commandParts.add(HISTORY_CMD);
    if (maxCnt > 0) {
      commandParts.add(LIMITED_SWITCH);
      commandParts.add(String.valueOf(maxCnt));
    } else if (host.getConfig().isHistoryResticted) {
      int margin = host.getConfig().getHistoryRevisionsMargin();
      commandParts.add(LIMITED_SWITCH);
      commandParts.add(String.valueOf( margin ));
    }
    CCaseHistoryParser.fillParametersTail(commandParts);
    commandParts.add(path);

    log = TransparentVcs.cleartoolWithOutput(ArrayUtil.toStringArray(commandParts));

    if( log.contains( NOT_A_VOB_OBJECT )) {
      throw new VcsException( log );
    } else {
      ArrayList<CCaseHistoryParser.SubmissionData> changes = CCaseHistoryParser.parse( log );
      for (CCaseHistoryParser.SubmissionData change : changes) {
        consumer.consume(change);
      }
    }
  }