3 unstable releases

0.2.0 Aug 14, 2024
0.1.1 Aug 12, 2024
0.1.0 Apr 14, 2024

#493 in Development tools

Download history 289/week @ 2024-12-24 395/week @ 2024-12-31 222/week @ 2025-01-07 177/week @ 2025-01-14 176/week @ 2025-01-21 299/week @ 2025-01-28 1157/week @ 2025-02-04 3769/week @ 2025-02-11 1122/week @ 2025-02-18 1693/week @ 2025-02-25 3833/week @ 2025-03-04 4399/week @ 2025-03-11 1540/week @ 2025-03-18 1985/week @ 2025-03-25 1104/week @ 2025-04-01 813/week @ 2025-04-08

6,388 downloads per month
Used in 5 crates (via debian-analyzer)

Apache-2.0 and maybe GPL-2.0+

56KB
1.5K SLoC

Merge3

A rust implementation of 3-way merge of texts.

Given BASE, OTHER, THIS, tries to produce a combined text incorporating the changes from both BASE->OTHER and BASE->THIS. All three will typically be sequences of lines.

Example

use merge3::Merge3;

let base = vec!["common\n", "base\n"];
let this = vec!["common\n", "a\n"];
let other = vec!["common\n", "b\n"];

let m3 = Merge3::new(&base, &this, &other);

for line in m3.merge_lines(false, &merge3::StandardMarkers::default()) {
    println!("{}", line);
}

Merge3

A rust implementation of 3-way merge of texts.

Given BASE, OTHER, THIS, tries to produce a combined text incorporating the changes from both BASE->OTHER and BASE->THIS. All three will typically be sequences of lines.

Usage

From the command-line::


$ echo foo > mine
$ echo bar > base
$ echo blah > other
$ merge3 mine base other > merged
$ cat merged

Or from rust:


use merge3::Merge3;

fn main() {
    let base = vec!["common\n", "base\n"];
    let this = vec!["common\n", "a\n"];
    let other = vec!["common\n", "b\n"];

    let m3 = Merge3::new(&base, &this, &other);

    for line in m3.merge_lines() {
        println!("{}", line);
    }
}

Dependencies

~31–295KB