static void TestValidDiff(Hashtable a, Hashtable b, HashDiff diff) { diff.Apply(a); HashDiff newdiff = JsonDiff.Diff(a, b); System.Diagnostics.Debug.Assert(newdiff.Empty()); }
/// <summary> /// Computes the three-way-merge of Json hashtables. /// </summary> public static Hashtable Merge(Hashtable parent, Hashtable left, Hashtable right) { HashDiff left_diff = JsonDiff.Diff(parent, left); HashDiff right_diff = JsonDiff.Diff(parent, right); HashDiff diff = HashDiff.Merge(left_diff, right_diff); Hashtable res = parent.DeepClone(); diff.Apply(res); return(res); }
/// <summary> /// Computes the three-way-merge of Json hashtables and returns the intermediate diff results. /// </summary> public static Hashtable MergeDetailed(Hashtable parent, Hashtable left, Hashtable right, out HashDiff left_diff, out HashDiff right_diff, out HashDiff merged_diff) { left_diff = JsonDiff.Diff(parent, left); right_diff = JsonDiff.Diff(parent, right); merged_diff = HashDiff.Merge(left_diff, right_diff); Hashtable res = parent.DeepClone(); merged_diff.Apply(res); return(res); }
public override void Apply(Hashtable h, string key) { Diff.Apply(h[key] as Hashtable); }