diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2010-11-19 20:17:34 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2010-11-19 20:17:34 -0800 |
commit | c44bbc41c44a97e2e598f542b9d96b145a1d28e0 (patch) | |
tree | f894145182d3a052572bc019590610405466431d | |
parent | b436dbd7e2c55b5f07d57fddd325abcd8b78288d (diff) | |
download | vyatta-config-mgmt-c44bbc41c44a97e2e598f542b9d96b145a1d28e0.tar.gz vyatta-config-mgmt-c44bbc41c44a97e2e598f542b9d96b145a1d28e0.zip |
Filter version string off diff when comparing active/working to a file.
-rwxr-xr-x | scripts/vyatta-config-mgmt.pl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/vyatta-config-mgmt.pl b/scripts/vyatta-config-mgmt.pl index 4516f79..ae4344d 100755 --- a/scripts/vyatta-config-mgmt.pl +++ b/scripts/vyatta-config-mgmt.pl @@ -91,6 +91,23 @@ sub parse_at_output { return (1, '', ''); } +sub filter_version_string { + my ($diff) = @_; + + my @lines = split("\n", $diff); + + my @new_lines = (); + my $found = 0; + while (my $line = pop(@lines)) { + if (! $found) { + $found = 1 if $line =~ /^@@/; + } else { + unshift(@new_lines, $line); + } + } + return join("\n", @new_lines); +} + # # main @@ -254,6 +271,7 @@ if ($action eq 'diff') { my $filename1 = cm_commit_get_file_name($rev1); my $diff = `zdiff -u $filename1 $tmp_config_file`; if (defined $diff and length($diff) > 0) { + $diff = filter_version_string($diff); print $diff; } else { print "No changes between working and " |