summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2011-01-18 15:55:42 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2011-01-18 15:55:42 -0800
commit7ada0b665433d5eec84993f35ac5a6b8f934bfca (patch)
tree73273328266458135d9f3822c6ebf6eafdcf6539 /src
parent9d9100f05f1189314a4f0a5fdd70934a9de4c1ba (diff)
downloadvyatta-cfg-7ada0b665433d5eec84993f35ac5a6b8f934bfca.tar.gz
vyatta-cfg-7ada0b665433d5eec84993f35ac5a6b8f934bfca.zip
have caller handle edit level for context diff
Diffstat (limited to 'src')
-rw-r--r--src/cli_shell_api.cpp4
-rw-r--r--src/cnode/cnode-algorithm.cpp7
-rw-r--r--src/cnode/cnode-algorithm.hpp1
3 files changed, 8 insertions, 4 deletions
diff --git a/src/cli_shell_api.cpp b/src/cli_shell_api.cpp
index c04cf16..6546480 100644
--- a/src/cli_shell_api.cpp
+++ b/src/cli_shell_api.cpp
@@ -391,7 +391,9 @@ showCfg(Cstore& cstore, const vector<string>& args)
// just show the working config (no diff)
cnode::show_cfg(wroot, op_show_show_defaults, op_show_hide_secrets);
} else {
- cnode::show_cfg_diff(aroot, wroot, op_show_show_defaults,
+ vector<string> cur_path;
+ cstore.getEditLevel(cur_path);
+ cnode::show_cfg_diff(aroot, wroot, cur_path, op_show_show_defaults,
op_show_hide_secrets, op_show_context_diff);
}
}
diff --git a/src/cnode/cnode-algorithm.cpp b/src/cnode/cnode-algorithm.cpp
index 526a218..fbb26e9 100644
--- a/src/cnode/cnode-algorithm.cpp
+++ b/src/cnode/cnode-algorithm.cpp
@@ -820,7 +820,8 @@ _print_cmds_list(const char *op, vector<vector<string> >& list)
////// algorithms
void
-cnode::show_cfg_diff(const CfgNode& cfg1, const CfgNode& cfg2, bool show_def,
+cnode::show_cfg_diff(const CfgNode& cfg1, const CfgNode& cfg2,
+ vector<string>& cur_path, bool show_def,
bool hide_secret, bool context_diff)
{
if (cfg1.isInvalid() || cfg2.isInvalid()) {
@@ -832,14 +833,14 @@ cnode::show_cfg_diff(const CfgNode& cfg1, const CfgNode& cfg2, bool show_def,
printf("Configuration under specified path is empty\n");
return;
}
- vector<string> cur_path;
_show_diff(&cfg1, &cfg2, -1, cur_path, show_def, hide_secret, context_diff);
}
void
cnode::show_cfg(const CfgNode& cfg, bool show_def, bool hide_secret)
{
- show_cfg_diff(cfg, cfg, show_def, hide_secret);
+ vector<string> cur_path;
+ show_cfg_diff(cfg, cfg, cur_path, show_def, hide_secret);
}
void
diff --git a/src/cnode/cnode-algorithm.hpp b/src/cnode/cnode-algorithm.hpp
index 8837054..4b1ec2f 100644
--- a/src/cnode/cnode-algorithm.hpp
+++ b/src/cnode/cnode-algorithm.hpp
@@ -22,6 +22,7 @@
namespace cnode {
void show_cfg_diff(const CfgNode& cfg1, const CfgNode& cfg2,
+ vector<string>& cur_path,
bool show_def = false, bool hide_secret = false,
bool context_diff = false);
void show_cfg(const CfgNode& cfg, bool show_def = false,