From 851bac7b3c23decfcbaa8cfeab4a2d13f666d2fa Mon Sep 17 00:00:00 2001 From: Julien Rioux Date: Sat, 17 Dec 2011 07:53:22 -0500 Subject: [PATCH] Regtest script: Output an header row at every change of directory. --- scripts/build/output-distance.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/scripts/build/output-distance.py b/scripts/build/output-distance.py index 93483727a8..1ba27857ed 100755 --- a/scripts/build/output-distance.py +++ b/scripts/build/output-distance.py @@ -376,6 +376,9 @@ class FileLink: return '' + def directories (self): + return map (os.path.dirname, self.file_names) + def name (self): base = os.path.basename (self.file_names[1]) base = os.path.splitext (base)[0] @@ -383,6 +386,9 @@ class FileLink: base = os.path.splitext (base)[0] return base + def prefix (self): + return os.path.dirname (os.path.commonprefix (self.file_names)) + def extension (self): return os.path.splitext (self.file_names[1])[1] @@ -950,16 +956,25 @@ class ComparisonData: (changed, below, unchanged) = self.thresholded_results (threshold) + header_row = ''' + +distance +%(short_dir1)s +%(short_dir2)s + +''' table_rows = '' - old_prefix = os.path.split (dir1)[1] + old_prefix = None for link in changed: + this_prefix = link.prefix () + if (old_prefix != this_prefix): + old_prefix = this_prefix + short_dir1 = shorten_string (link.directories ()[0], 30) + short_dir2 = shorten_string (link.directories ()[1], 30) + table_rows += header_row % locals() table_rows += link.html_record_string (dest_dir) - - short_dir1 = shorten_string (dir1) - short_dir2 = shorten_string (dir2) - summary = '' below_count = len (below) @@ -1006,11 +1021,6 @@ class ComparisonData:
- - - - - %(table_rows)s
distance%(short_dir1)s%(short_dir2)s
-- 2.39.2