All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mdoc.internal.pos.DiffUtils.scala Maven / Gradle / Ivy

There is a newer version: 2.6.1
Show newest version
package mdoc.internal.pos

import difflib.{DiffUtils => DU}
import PositionSyntax._

object DiffUtils {
  def unifiedDiff(
      originalFileName: String,
      revisedFileName: String,
      originalLines: List[String],
      revisedLines: List[String],
      contextSize: Int
  ): String = {
    val patch = DU.diff(originalLines.asJava, revisedLines.asJava)
    val diff = DU.generateUnifiedDiff(
      originalFileName,
      revisedFileName,
      originalLines.asJava,
      patch,
      contextSize
    )
    diff.asScala.mkString("\n")
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy