private pushChunk()

in packages/blueprints/blueprint/src/resynthesis/merge-strategies/diff3.ts [163:203]


  private pushChunk(a: number, o: number, b: number) {
    const oText = this.lines.o.slice(this.currentLine.o, o - 1).join('');
    const aText = this.lines.a.slice(this.currentLine.a, a - 1).join('');
    const bText = this.lines.b.slice(this.currentLine.b, b - 1).join('');

    if (oText === aText && oText === bText) {
      this.mergedChunks.push({
        conflict: false,
        ok: oText,
      });
    } else if (oText === aText) {
      this.mergedChunks.push({
        conflict: false,
        ok: bText,
      });
    } else if (oText === bText) {
      this.mergedChunks.push({
        conflict: false,
        ok: aText,
      });
    } else if (aText === bText) {
      // false conflict, both copies modified the original in the same way.
      this.mergedChunks.push({
        conflict: false,
        ok: aText,
      });
    } else {
      this.mergedChunks.push({
        conflict: true,
        a: aText,
        o: oText,
        b: bText,
      });
    }

    this.currentLine = {
      o: o - 1,
      a: a - 1,
      b: b - 1,
    };
  }