From: Reinhold Kainhofer Date: Mon, 15 Aug 2011 17:37:29 +0000 (+0200) Subject: Fix 1529: hashed snippet filename changes should not count as log differences X-Git-Tag: release/2.15.10-1~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4ccfb61ecfa8b32f8c5d87e75c569171bbc54ba6;p=lilypond.git Fix 1529: hashed snippet filename changes should not count as log differences If the contents of a regtest change, the regtest gets a new hash and thus a new filename. Unfortunately, this will be detected by output-distance as a change and will show up in the regtest analysis. To work around this, I'm simply extracting the old and the new filename before we compare the log files and if they differ, I replace the old filename with the new filename in the old log file. Thus, it will appear as if the new filename was also used in the baseline and it will not be flagged as a difference. --- diff --git a/scripts/build/output-distance.py b/scripts/build/output-distance.py index 59499d16ac..b90bda5548 100644 --- a/scripts/build/output-distance.py +++ b/scripts/build/output-distance.py @@ -3,6 +3,7 @@ import sys import optparse import os import math +import re ## so we can call directly as scripts/build/output-distance.py me_path = os.path.abspath (os.path.split (sys.argv[0])[0]) @@ -468,11 +469,22 @@ class GitFileCompareLink (FileCompareLink): return d +snippet_fn_re = re.compile (r"`\./([0-9a-f]{2}/lily-[0-9a-f]{8}).eps'"); class TextFileCompareLink (FileCompareLink): def calc_distance (self): import difflib - diff = difflib.unified_diff (self.contents[0].strip().split ('\n'), - self.contents[1].strip().split ('\n'), + # Extract the old and the new hashed snippet names from the log file + # and replace the old by the new, so file name changes don't show + # up as log differences... + cont0 = self.contents[0].strip(); + cont1 = self.contents[1].strip(); + m0 = re.search (snippet_fn_re, cont0); + m1 = re.search (snippet_fn_re, cont1); + if (m0 and m1 and (m0.group(1) != m1.group(1))): + cont0 = cont0.replace (m0.group(1), m1.group(1)); + + diff = difflib.unified_diff (cont0.split ('\n'), + cont1.split ('\n'), fromfiledate = self.file_names[0], tofiledate = self.file_names[1] ) @@ -754,7 +766,6 @@ class SignatureFileLink (FileLink): # Files/directories import glob -import re def compare_signature_files (f1, f2): s1 = read_signature_file (f1)