diff --git a/src/list/merge.rs b/src/list/merge.rs index 7e62836..d3b0e85 100644 --- a/src/list/merge.rs +++ b/src/list/merge.rs @@ -64,8 +64,10 @@ impl ListBranch { /// Add everything in merge_frontier into the set.. pub fn merge(&mut self, oplog: &ListOpLog, merge_frontier: &[LV]) { let mut iter = oplog.get_xf_operations_full(self.version.as_ref(), merge_frontier); + // println!("merge '{}' at {:?} + {:?}", self.content.to_string(), self.version, merge_frontier); for (_lv, origin_op, xf) in &mut iter { + // dbg!(_lv, &origin_op, &xf); match (origin_op.kind, xf) { (ListOpKind::Ins, BaseMoved(pos)) => { // println!("Insert '{}' at {} (len {})", op.content, ins_pos, op.len()); @@ -92,8 +94,13 @@ impl ListBranch { } } + // dbg!(iter.count_range_tracker_size()); + + // let expect_v = oplog.cg.graph.find_dominators_2(self.version.as_ref(), merge_frontier); self.version = iter.into_frontier(); + // println!("-> '{}' v {:?}", self.content.to_string(), self.version); + // assert_eq!(self.version, expect_v); } } \ No newline at end of file diff --git a/src/list/oplog_merge_fuzzer.rs b/src/list/oplog_merge_fuzzer.rs index 9192f36..2409010 100644 --- a/src/list/oplog_merge_fuzzer.rs +++ b/src/list/oplog_merge_fuzzer.rs @@ -56,6 +56,7 @@ fn oplog_merge_fuzz(seed: u64, verbose: bool) { a.branch.merge(&a.oplog, a.oplog.cg.version.as_ref()); b.branch.merge(&b.oplog, b.oplog.cg.version.as_ref()); + // assert_eq!(a.branch.content.to_string(), b.branch.content.to_string()); assert_eq!(a.branch.content, b.branch.content); } diff --git a/src/list_fuzzer_tools.rs b/src/list_fuzzer_tools.rs index b7f798a..c3cdcce 100644 --- a/src/list_fuzzer_tools.rs +++ b/src/list_fuzzer_tools.rs @@ -16,6 +16,10 @@ const USE_UNICODE: bool = true; const UCHARS: [char; 23] = [ 'a', 'b', 'c', '1', '2', '3', ' ', '\n', // ASCII + // 'd', 'e', 'f', + // 'g', 'h', 'i', 'j', + // 'k', 'l', 'm', 'n', + // 'r', 'q', 'p', 'o', '©', '¥', '½', // The Latin-1 suppliment (U+80 - U+ff) 'Ύ', 'Δ', 'δ', 'Ϡ', // Greek (U+0370 - U+03FF) '←', '↯', '↻', '⇈', // Arrows (U+2190 – U+21FF) diff --git a/src/listmerge/merge.rs b/src/listmerge/merge.rs index 4824d2a..1de421d 100644 --- a/src/listmerge/merge.rs +++ b/src/listmerge/merge.rs @@ -666,6 +666,9 @@ impl<'a> TransformedOpsIter2<'a> { from_frontier: &[LV], merge_frontier: &[LV]) -> Self { let (plan, common) = subgraph.make_m1_plan(from_frontier, merge_frontier); + // println!("From: {:?} / merge: {:?} common {:?}", from_frontier, merge_frontier, common); + // plan.dbg_print(); + Self { subgraph, aa, diff --git a/src/listmerge2/merge1plan.rs b/src/listmerge2/merge1plan.rs index 1cec0a3..59d0d0b 100644 --- a/src/listmerge2/merge1plan.rs +++ b/src/listmerge2/merge1plan.rs @@ -426,7 +426,7 @@ impl Graph { pub(crate) fn make_m1_plan(&self, a: &[LV], b: &[LV]) -> (M1Plan, Frontier) { if self.frontier_contains_frontier(a, b) { // Nothing to merge. Do nothing. - return (M1Plan(vec![]), Frontier::root()); + return (M1Plan(vec![]), a.into()); } let mut sg = self.make_conflict_graph_between(a, b);