add filename and sha in comments in report output

Add debugging details with the filename and sha for the version of the
content used so that each note that comes out in the report indicates
where the content is from.

Change-Id: I569f3dbd3df16f880c8f3fa0a1b5b1c1b77be45d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann
2017-02-22 22:59:51 -05:00
parent a92bef64d4
commit b0ba2eeea5
2 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1,7 @@
---
features:
- |
The report output now includes debugging details with the filename
and sha for the version of the content used to indicate where the
content is from to assist with debugging formatting or content
issues.

View File

@ -61,12 +61,13 @@ def format_report(loader, versions_to_include, title=None):
notefiles = loader[version]
for n, sha in notefiles:
if 'prelude' in file_contents[n]:
report.append('.. %s @ %s\n' % (n, sha))
report.append(file_contents[n]['prelude'])
report.append('')
for section_name, section_title in _SECTION_ORDER:
notes = [
n
(n, fn, sha)
for fn, sha in notefiles
if file_contents[fn].get(section_name)
for n in file_contents[fn].get(section_name, [])
@ -75,7 +76,8 @@ def format_report(loader, versions_to_include, title=None):
report.append(section_title)
report.append('-' * len(section_title))
report.append('')
for n in notes:
for n, fn, sha in notes:
report.append('.. %s @ %s\n' % (fn, sha))
report.append('- %s' % _indent_for_list(n))
report.append('')