From db3e99263e79e6b38a47cfec12822d358bf0a6df Mon Sep 17 00:00:00 2001 From: Bjoern Gruening Date: Mon, 2 Dec 2024 11:32:11 +0100 Subject: [PATCH 01/11] add new -y parameter, bump version, adopt tests, WIP --- tools/diff/diff.xml | 64 +++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index b3070c6903..7cd685d4ee 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,8 +13,15 @@ '$diff_file'; - #if $generate_report: + diff + #if $report_format.report_format_select in ['txt_lines', 'html']: + ## the -u option is needed to convert the output later to HTML + -u + #else if $report_format.report_format_select == 'txt_columns': + -y + #end if + '$input1' '$input2' > '$diff_file' && + #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 '/@@diffoutput@@/{r'$diff_file'' -e ';d}' @@ -25,11 +32,21 @@ - - - - - + + + + + + + + + + + + + + + @@ -41,7 +58,9 @@ - + + + @@ -51,7 +70,9 @@ - + + + @@ -63,7 +84,9 @@ - + + + @@ -73,8 +96,10 @@ - - + + + + @@ -85,8 +110,10 @@ - - + + + + @@ -97,7 +124,10 @@ - + + + + From deb7f1c9fcb76547dc31d1031a3841d097a505ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gr=C3=BCning?= Date: Mon, 2 Dec 2024 12:10:39 +0100 Subject: [PATCH 02/11] Update diff.xml --- tools/diff/diff.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index 7cd685d4ee..b4da2d4061 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -20,8 +20,9 @@ #else if $report_format.report_format_select == 'txt_columns': -y #end if - '$input1' '$input2' > '$diff_file' && + '$input1' '$input2' > '$diff_file' #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 '/@@diffoutput@@/{r'$diff_file'' -e ';d}' From 66f1622c4660b595b9837cc8ff546e2bb705ce50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gr=C3=BCning?= Date: Mon, 2 Dec 2024 12:45:43 +0100 Subject: [PATCH 03/11] Update diff.xml --- tools/diff/diff.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index b4da2d4061..eefba264a9 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -52,7 +52,7 @@ - generate_report is True + report_format['report_format_select'] == 'html' From 667a7acf3a1cee36b8ce5718d7893bd8bb9f59ce Mon Sep 17 00:00:00 2001 From: Bjoern Gruening Date: Mon, 2 Dec 2024 13:01:44 +0100 Subject: [PATCH 04/11] add unified option with integer --- tools/diff/diff.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index eefba264a9..c6972cf5a7 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -16,7 +16,7 @@ diff #if $report_format.report_format_select in ['txt_lines', 'html']: ## the -u option is needed to convert the output later to HTML - -u + --unified $report_format.unified #else if $report_format.report_format_select == 'txt_columns': -y #end if @@ -39,7 +39,9 @@ - + + + From c4f6fedd2ee7ab27dc51f614fc484682c74c880a Mon Sep 17 00:00:00 2001 From: Bjoern Gruening Date: Mon, 2 Dec 2024 13:04:49 +0100 Subject: [PATCH 05/11] fix another missing template --- tools/diff/diff.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index c6972cf5a7..892458b87d 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -17,14 +17,14 @@ #if $report_format.report_format_select in ['txt_lines', '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': + #else if $report_format.report_format_select == 'txt_columns': -y #end if '$input1' '$input2' > '$diff_file' #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_select.output_format'/g' -e '/@@diffoutput@@/{r'$diff_file'' -e ';d}' '$__tool_directory__/template.html' > '$html_file' #end if From 6cc4955b91a899ce90fe088a88607490456290d1 Mon Sep 17 00:00:00 2001 From: RZ9082 Date: Wed, 4 Dec 2024 15:28:40 +0100 Subject: [PATCH 06/11] adjust command and input/output sections and add tests --- tools/diff/diff.xml | 121 ++++++++++-------- .../diff/test-data/{file 3.txt => file3.txt} | 0 tools/diff/test-data/output_test4.txt | 2 + 3 files changed, 73 insertions(+), 50 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 892458b87d..84612485e5 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -1,4 +1,4 @@ - + analyzes two files and generates an unidiff text file with information about the differences and an optional Html report 3.10 @@ -14,17 +14,20 @@ '$diff_file' - #if $report_format.report_format_select == 'html': - && + '$input1' '$input2' > '$diff_file'; + #if $HTML_report.HTML_report_select == 'yes' sed -e 's/@@title@@/Diff report for "$input1.element_identifier" and "$input2.element_identifier"/g' - -e 's/@@outputformat@@/'$report_format_select.output_format'/g' + -e 's/@@outputformat@@/'$HTML_report.output_format_html_select'/g' -e '/@@diffoutput@@/{r'$diff_file'' -e ';d}' '$__tool_directory__/template.html' > '$html_file' #end if @@ -33,37 +36,45 @@ - - - - - + + + + - + - - - - + + + + + + + + + + + + + + + - - - report_format['report_format_select'] == 'html' + + + HTML_report['HTML_report_select'] == 'yes' - - - + @@ -73,23 +84,40 @@ - - - + + + + + + + + + + + + + + + - - - + + + + + + + + + + - - - + @@ -99,10 +127,8 @@ - - - - + + @@ -113,10 +139,8 @@ - - - - + + @@ -125,12 +149,9 @@ - - - - - - + + + @@ -202,4 +223,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 From 9ce769ee73ae288fe74b1dbbf98595914c3b094d Mon Sep 17 00:00:00 2001 From: RZ9082 Date: Wed, 4 Dec 2024 15:44:17 +0100 Subject: [PATCH 07/11] increment version suffix --- tools/diff/diff.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index 84612485e5..26e26fcd09 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -2,7 +2,7 @@ analyzes two files and generates an unidiff text file with information about the differences and an optional Html report 3.10 - 0 + 1 diffutils From 174ef20cfa9899fbb2d82e7868f33658a58b9666 Mon Sep 17 00:00:00 2001 From: RZ9082 Date: Wed, 4 Dec 2024 15:49:32 +0100 Subject: [PATCH 08/11] re-add profile --- tools/diff/diff.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index 26e26fcd09..0cd9fb8378 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -1,4 +1,4 @@ - + analyzes two files and generates an unidiff text file with information about the differences and an optional Html report 3.10 From a78055534e3bcb01bc62a33b9ae61164c39edc06 Mon Sep 17 00:00:00 2001 From: RZ9082 Date: Mon, 9 Dec 2024 14:01:09 +0100 Subject: [PATCH 09/11] handle diff exit-code 1 --- tools/diff/diff.xml | 117 ++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 69 deletions(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index 0cd9fb8378..69e9893278 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -2,7 +2,7 @@ analyzes two files and generates an unidiff text file with information about the differences and an optional Html report 3.10 - 1 + 0 diffutils @@ -14,20 +14,16 @@ '$diff_file'; - #if $HTML_report.HTML_report_select == 'yes' + '$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@@/'$HTML_report.output_format_html_select'/g' + -e 's/@@outputformat@@/'$report_format.output_format'/g' -e '/@@diffoutput@@/{r'$diff_file'' -e ';d}' '$__tool_directory__/template.html' > '$html_file' #end if @@ -36,88 +32,64 @@ - - - - + + + + + - + - + + + + + - - - - - - - - - - - - - - - - - HTML_report['HTML_report_select'] == 'yes' + + + report_format['report_format_select'] == 'html' - + + + - - - - - - - - - - - - - + - - - + + + - - - + + + - - - - - - - - + + + @@ -127,8 +99,10 @@ - - + + + + @@ -139,8 +113,10 @@ - - + + + + @@ -151,7 +127,10 @@ - + + + + From fd72412a843a00b7d505ec9624c581249c590d37 Mon Sep 17 00:00:00 2001 From: RZ9082 Date: Mon, 9 Dec 2024 15:08:03 +0100 Subject: [PATCH 10/11] add a comment --- tools/diff/diff.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index 69e9893278..3946888426 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -20,6 +20,7 @@ #else if $report_format.report_format_select == 'txt_columns' -y #end if + ## If the compared input files differ the diff command return 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' From 3c61e1cb3c09e230c6587eb82c6649fc8e2c5347 Mon Sep 17 00:00:00 2001 From: RZ9082 Date: Mon, 9 Dec 2024 15:10:39 +0100 Subject: [PATCH 11/11] typo --- tools/diff/diff.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/diff/diff.xml b/tools/diff/diff.xml index 3946888426..3ae9bb00b9 100644 --- a/tools/diff/diff.xml +++ b/tools/diff/diff.xml @@ -20,7 +20,7 @@ #else if $report_format.report_format_select == 'txt_columns' -y #end if - ## If the compared input files differ the diff command return exit-code 1 + ## 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'