With the previous commit, they're in effect sorted by the types of the interface changes. As a lazy measure to sort changes by the breakages they cause, sort the content reverse alphabetically, which works OK by accident.
Unified · Split
| @@ -34,18 +34,19 @@ def add_new_entries(docs_dir, out, git): · 33 unmodified lines | |||
| 34 | timestamp = check_output([git, "log", "--format=%ct", "-n", "1", "--", | 34 | timestamp = check_output([git, "log", "--format=%ct", "-n", "1", "--", |
| 35 | f], encoding="UTF-8") | 35 | f], encoding="UTF-8") |
| 36 | if timestamp: | 36 | if timestamp: |
| 37 | files.append((f, timestamp)) | 37 | content = f.read_text() |
| 38 | files.append(content) | ||
| 38 | else: | 39 | else: |
| 39 | print(f"Skipping file not tracked by git: {f.name}") | 40 | print(f"Skipping file not tracked by git: {f.name}") |
| 40 | 41 | ||
| 41 | files.sort(key=lambda x: x[1]) | 42 | # Sort the changes by "severity", which roughly corresponds to |
| 42 | for file in files: | 43 | # alphabetical order by accident (e.g. remove > deprecate > change > add) |
| 43 | with open(file[0].resolve(), "r") as f: | 44 | for file in reversed(sorted(files)): |
| 44 | for line in f: | 45 | for line in file.splitlines(): |
| 45 | line = textwrap.fill(line.rstrip(), width=80, | 46 | line = textwrap.fill(line.rstrip(), width=80, |
| 46 | initial_indent=" - ", | 47 | initial_indent=" - ", |
| 47 | subsequent_indent=" ") | 48 | subsequent_indent=" ") |
| 48 | out.write(line + "\n") | 49 | out.write(line + "\n") |
| 49 | 50 | ||
| 50 | if __name__ == "__main__": | 51 | if __name__ == "__main__": |
| 51 | if len(sys.argv) < 2: | 52 | if len(sys.argv) < 2: |