#merge #histogram #diff #algorithm #order #private #api

yanked imara-mergy

A merge implementation using histogram diff algorithm

4 releases

0.1.3 Dec 20, 2024
0.1.2 Dec 17, 2024
0.1.1 Dec 17, 2024
0.1.0 Dec 17, 2024

#58 in #histogram

Download history 101/week @ 2024-12-11 206/week @ 2024-12-18 23/week @ 2024-12-25

330 downloads per month

MIT/Apache

42KB
968 lines

imara-mergy

A merge implementation using histogram diff algorithm


lib.rs:

This library implements merging of two files using histogram diff. In order to achieve this, it combines imara_diff and diffy (hence the name). Namely, it uses the public API of the former and vendors the private API of the latter, and bridges the gap between the types used.

It was created mainly for use in mergiraf.

Usage

use imara_mergy::{merge, merge_options::MergeOptions};

let base = r#"my_struct_t instance = {
    .a = 1,
    .c = 3,
    .e = 5,
};
"#;

let left = r#"my_struct_t instance = {
    .a = 1,
    .b = 2,
    .c = 3,
    .e = 5,
};
"#;

let right = r#"my_struct_t instance = {
    .a = 1,
    .c = 3,
    .d = 4,
    .e = 5,
};
"#;

let after_expected = r#"my_struct_t instance = {
    .a = 1,
    .b = 2,
    .c = 3,
    .d = 4,
    .e = 5,
};
"#;

let opts = MergeOptions::default();

let after = merge(base, left, right, opts);

assert_eq!(after.unwrap(), after_expected);

Dependencies

~3MB
~48K SLoC