Crates.io | merge3 |
lib.rs | merge3 |
version | 0.2.0 |
source | src |
created_at | 2024-04-14 15:43:58.783167 |
updated_at | 2024-08-14 23:49:01.406494 |
description | A simple merge tool for three-way merges |
homepage | |
repository | https://github.com/breezy-team/merge3-rs |
max_upload_size | |
id | 1208330 |
size | 63,956 |
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.
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);
}
}