static void TestValidDiff(Hashtable a, Hashtable b, HashDiff diff)
        {
            diff.Apply(a);
            HashDiff newdiff = JsonDiff.Diff(a, b);

            System.Diagnostics.Debug.Assert(newdiff.Empty());
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
 public override void Apply(Hashtable h, string key)
 {
     Diff.Apply(h[key] as Hashtable);
 }