patch_main method

List<Patch> patch_main(
  1. String text1,
  2. String text2
)

Compute a list of patches to turn text1 into text2. Use diffs if provided, otherwise compute it ourselves. There are four ways to call this function, depending on what data is available to the caller:

Returns a List of Patch objects.

Implementation

List<Patch> patch_main(String text1, String text2) {
  // Method 1: text1, text2
  // Compute diffs from text1 and text2.
  final diffs = diff_main(text1, text2, true);
  if (diffs.length > 2) {
    diff_cleanupSemantic(diffs);
    diff_cleanupEfficiency(diffs);
  }
  return patch_make(text1, diffs);
}