summaryrefslogtreecommitdiff
path: root/src/config_diff.ml
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-07-08 08:01:19 -0500
committerGitHub <noreply@github.com>2025-07-08 08:01:19 -0500
commit74c67327160d8dffb8d79bf6691852855715d5f8 (patch)
treec63ea88a83a0c7bea55ac56729668dd6674ee140 /src/config_diff.ml
parentdb5220be72b545863aca753f6d7c159bab98446a (diff)
parentc01c370535640d3cbd4e4c3839d570c596e11695 (diff)
downloadvyos1x-config-current.tar.gz
vyos1x-config-current.zip
Merge pull request #45 from jestabro/merge-configHEADcurrent
T7499: add non-/destructive configtree merge
Diffstat (limited to 'src/config_diff.ml')
-rw-r--r--src/config_diff.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config_diff.ml b/src/config_diff.ml
index 87b2663..73c379b 100644
--- a/src/config_diff.ml
+++ b/src/config_diff.ml
@@ -456,3 +456,13 @@ let tree_union s t =
Vytree.make_full data (name_of v) (children_of v)
in
Tree_alg.ConfigAlg.tree_union s t f
+
+let tree_merge ?(destructive=false) s t =
+ let f u v =
+ let data =
+ match destructive with
+ | false -> data_of u
+ | true -> data_of v
+ in Vytree.make_full data (name_of v) (children_of v)
+ in
+ Tree_alg.ConfigAlg.tree_union s t f