Package org.sonar.api.utils.command

Examples of org.sonar.api.utils.command.StringStreamConsumer


  private void blame(final FileSystem fs, final InputFile inputFile, final BlameOutput output) {
    String filename = inputFile.relativePath();
    Command cl = createCommandLine(fs.baseDir(), filename);
    SvnBlameConsumer consumer = new SvnBlameConsumer(filename);
    StringStreamConsumer stderr = new StringStreamConsumer();
    int exitCode;
    try {
      exitCode = execute(cl, consumer, stderr);
    } catch (CommandException e) {
      // Unwrap CommandException
      throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new IllegalStateException(e.getCause());
    }
    if (exitCode != 0) {
      throw new IllegalStateException("The svn blame command [" + cl.toString() + "] failed: " + stderr.getOutput());
    }
    List<BlameLine> lines = consumer.getLines();
    if (lines.size() == inputFile.lines() - 1) {
      // SONARPLUGINS-3097 SVN do not report blame on last empty line
      lines.add(lines.get(lines.size() - 1));
View Full Code Here


  private void blame(File baseDir, BlameOutput output, InputFile inputFile) {
    String filename = inputFile.relativePath();
    Command cl = createCommandLine(baseDir, filename);
    GitBlameConsumer consumer = new GitBlameConsumer(filename);
    StringStreamConsumer stderr = new StringStreamConsumer();

    int exitCode = execute(cl, consumer, stderr);
    if (exitCode != 0) {
      throw new IllegalStateException("The git blame command [" + cl.toString() + "] failed: " + stderr.getOutput());
    }
    List<BlameLine> lines = consumer.getLines();
    if (lines.size() == inputFile.lines() - 1) {
      // SONARPLUGINS-3097 Git do not report blame on last empty line
      lines.add(lines.get(lines.size() - 1));
View Full Code Here

TOP

Related Classes of org.sonar.api.utils.command.StringStreamConsumer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.