From 1a6c4a793ef68a43de93316523c1cd9196d80b73 Mon Sep 17 00:00:00 2001 From: Rand Zoabi <58028465+RZ9082@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:24:12 +0100 Subject: [PATCH] Diff add -y parameter (#1555) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add new -y parameter, bump version, adopt tests, WIP * Update diff.xml * Update diff.xml * add unified option with integer * fix another missing template * adjust command and input/output sections and add tests * increment version suffix * re-add profile * handle diff exit-code 1 * add a comment * typo --------- Co-authored-by: Bjoern Gruening Co-authored-by: Björn Grüning --- tools/diff/diff.xml | 80 +++++++++++++------ .../diff/test-data/{file 3.txt => file3.txt} | 0 tools/diff/test-data/output_test4.txt | 2 + 3 files changed, 59 insertions(+), 23 deletions(-) rename tools/diff/test-data/{file 3.txt => file3.txt} (100%) create mode 100644 tools/diff/test-data/output_test4.txt diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index b3070c6903..3ae9bb00b9 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -1,7 +1,7 @@ - + analyzes two files and generates an unidiff text file with information about the differences and an optional Html report - 3.7 + 3.10 0 @@ -13,10 +13,18 @@ '$diff_file'; - #if $generate_report: + diff + #if $report_format.report_format_select == 'txt_lines' or $report_format.report_format_select == 'html' + ## the -u option is needed to convert the output later to HTML + --unified=$report_format.unified + #else if $report_format.report_format_select == 'txt_columns' + -y + #end if + ## If the compared input files differ the diff command returns exit-code 1 + '$input1' '$input2' > '$diff_file' || [ \$? -eq 1 ]; + #if $report_format.report_format_select == 'html' sed -e 's/@@title@@/Diff report for "$input1.element_identifier" and "$input2.element_identifier"/g' - -e 's/@@outputformat@@/'$output_format'/g' + -e 's/@@outputformat@@/'$report_format.output_format'/g' -e '/@@diffoutput@@/{r'$diff_file'' -e ';d}' '$__tool_directory__/template.html' > '$html_file' #end if @@ -25,33 +33,50 @@ - - - - - + + + + + + + + + + + + + + + + + + - generate_report is True + report_format['report_format_select'] == 'html' - + + + - + - + + + @@ -63,7 +88,9 @@ - + + + @@ -73,8 +100,10 @@ - - + + + + @@ -85,8 +114,10 @@ - - + + + + @@ -95,9 +126,12 @@ - - - + + + + + + @@ -169,4 +203,4 @@ An **optional** *HTML report* with a friendlier visual representation of the dif } - + \ No newline at end of file diff --git a/tools/diff/test-data/file 3.txt b/tools/diff/test-data/file3.txt similarity index 100% rename from tools/diff/test-data/file 3.txt rename to tools/diff/test-data/file3.txt diff --git a/tools/diff/test-data/output_test4.txt b/tools/diff/test-data/output_test4.txt new file mode 100644 index 0000000000..db4ccf3cd8 --- /dev/null +++ b/tools/diff/test-data/output_test4.txt @@ -0,0 +1,2 @@ +a a + > b