From 0ad59d33008880ad8622a4a31ca495f8924bf3e5 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Fri, 24 Jan 2025 13:23:38 +0100 Subject: [PATCH] show EXPLICIT compare diff only --- CHANGELOG.md | 1 + lib/src/clixon_datastore_read.c | 6 ++---- lib/src/clixon_text_syntax.c | 1 + lib/src/clixon_xml_io.c | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b99e0f37..fada8f67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Developers may need to change their code ### Corrected Bugs +* Fixed: [Incorrect fields displayed for "show compare" and "commit diff"](https://github.com/clicon/clixon-controller/issues/177) * Fixed: [Documentation corresponding to specific release](https://github.com/clicon/clixon-controller/issues/178) * https://clixon-docs.readthedocs.io/en/stable points to lastest release, starting with 7.2.0 * Fixed: [Backend hangs when doing "process services restart" in the CLI](https://github.com/clicon/clixon-controller/issues/178) diff --git a/lib/src/clixon_datastore_read.c b/lib/src/clixon_datastore_read.c index a8dbe220..4de26a8b 100644 --- a/lib/src/clixon_datastore_read.c +++ b/lib/src/clixon_datastore_read.c @@ -844,7 +844,6 @@ xmldb_get_cache(clixon_handle h, * @param[in] yb How to bind yang to XML top-level when parsing * @param[in] nsc External XML namespace context, or NULL * @param[in] xpath String with XPath syntax. or NULL for all - * @param[in] wdef With-defaults parameter, see RFC 6243 * @param[out] xret Single return XML tree. Free with xml_free() * @param[out] msdiff If set, return modules-state differences * @param[out] xerr XML error if retval is 0 @@ -859,7 +858,6 @@ xmldb_get_copy(clixon_handle h, yang_bind yb, cvec *nsc, const char *xpath, - withdefaults_type wdef, cxobj **xret, modstate_diff_t *msdiff, cxobj **xerr) @@ -1052,8 +1050,8 @@ xmldb_get0(clixon_handle h, cxobj *x = NULL; if (wdef != WITHDEFAULTS_EXPLICIT) - return xmldb_get_copy(h, db, yb, nsc, xpath, 0, xret, msdiff, xerr); - if ((ret = xmldb_get_copy(h, db, yb, nsc, xpath, 0, &x, msdiff, xerr)) < 0) + return xmldb_get_copy(h, db, yb, nsc, xpath, xret, msdiff, xerr); + if ((ret = xmldb_get_copy(h, db, yb, nsc, xpath, &x, msdiff, xerr)) < 0) goto done; if (ret == 0) goto fail; diff --git a/lib/src/clixon_text_syntax.c b/lib/src/clixon_text_syntax.c index 40e2b4ae..73bd6889 100644 --- a/lib/src/clixon_text_syntax.c +++ b/lib/src/clixon_text_syntax.c @@ -120,6 +120,7 @@ tleaf(cxobj *x) * 0: No leaflist * 1: In leaflist * @see text2cbuf to buffer (slower) + * XXX No with-defaults support as in xml2cbuf */ static int text2file(cxobj *xn, diff --git a/lib/src/clixon_xml_io.c b/lib/src/clixon_xml_io.c index e4382b58..0e6a3251 100644 --- a/lib/src/clixon_xml_io.c +++ b/lib/src/clixon_xml_io.c @@ -1461,7 +1461,7 @@ xml_diff2cbuf(cbuf *cb, xml_diff_keys(cb, x1, y0, (level+1)*PRETTYPRINT_INDENT); nr++; } - if (clixon_xml2cbuf(cb, x1c, level+1, 1, "+", -1, 0) < 0) + if (clixon_xml2cbuf1(cb, x1c, level+1, 1, "+", -1, 0, WITHDEFAULTS_EXPLICIT) < 0) goto done; x1c = xml_child_each(x1, x1c, CX_ELMNT); continue; @@ -1472,7 +1472,7 @@ xml_diff2cbuf(cbuf *cb, xml_diff_keys(cb, x0, y0, (level+1)*PRETTYPRINT_INDENT); nr++; } - if (clixon_xml2cbuf(cb, x0c, level+1, 1, "-", -1, 0) < 0) + if (clixon_xml2cbuf1(cb, x0c, level+1, 1, "-", -1, 0, WITHDEFAULTS_EXPLICIT) < 0) goto done; x0c = xml_child_each(x0, x0c, CX_ELMNT); continue; @@ -1495,7 +1495,7 @@ xml_diff2cbuf(cbuf *cb, xml_diff_keys(cb, x0, y0, (level+1)*PRETTYPRINT_INDENT); nr++; } - if (clixon_xml2cbuf(cb, xi, level+1, 1, "-", -1, 0) < 0) + if (clixon_xml2cbuf1(cb, xi, level+1, 1, "-", -1, 0, WITHDEFAULTS_EXPLICIT) < 0) goto done; } } @@ -1513,7 +1513,7 @@ xml_diff2cbuf(cbuf *cb, xml_diff_keys(cb, x1, y0, (level+1)*PRETTYPRINT_INDENT); nr++; } - if (clixon_xml2cbuf(cb, xj, level+1, 1, "+", -1, 0) < 0) + if (clixon_xml2cbuf1(cb, xj, level+1, 1, "+", -1, 0, WITHDEFAULTS_EXPLICIT) < 0) goto done; } } @@ -1528,7 +1528,7 @@ xml_diff2cbuf(cbuf *cb, xml_diff_keys(cb, x0, y0, (level+1)*PRETTYPRINT_INDENT); nr++; } - if (clixon_xml2cbuf(cb, x0c, level+1, 1, "-", -1, 0) < 0) + if (clixon_xml2cbuf1(cb, x0c, level+1, 1, "-", -1, 0, WITHDEFAULTS_EXPLICIT) < 0) goto done; x0c = xml_child_each(x0, x0c, CX_ELMNT); continue; @@ -1539,7 +1539,7 @@ xml_diff2cbuf(cbuf *cb, xml_diff_keys(cb, x1, y0, (level+1)*PRETTYPRINT_INDENT); nr++; } - if (clixon_xml2cbuf(cb, x1c, level+1, 1, "+", -1, 0) < 0) + if (clixon_xml2cbuf1(cb, x1c, level+1, 1, "+", -1, 0, WITHDEFAULTS_EXPLICIT) < 0) goto done; x1c = xml_child_each(x1, x1c, CX_ELMNT); continue; @@ -1554,9 +1554,9 @@ xml_diff2cbuf(cbuf *cb, xml_diff_keys(cb, x0, y0, (level+1)*PRETTYPRINT_INDENT); nr++; } - if (clixon_xml2cbuf(cb, x0c, level+1, 1, "-", -1, 0) < 0) + if (clixon_xml2cbuf1(cb, x0c, level+1, 1, "-", -1, 0, WITHDEFAULTS_EXPLICIT) < 0) goto done; - if (clixon_xml2cbuf(cb, x1c, level+1, 1, "+", -1, 0) < 0) + if (clixon_xml2cbuf1(cb, x1c, level+1, 1, "+", -1, 0, WITHDEFAULTS_EXPLICIT) < 0) goto done; } else if (y0c && yang_keyword_get(y0c) == Y_LEAF){