mirror of
https://github.com/mpv-player/mpv
synced 2025-03-03 12:47:49 +00:00
TOOLS/gen-interface-changes.py: sort interface changes by file content
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.
This commit is contained in:
parent
20bd4483b1
commit
e8905650fe
@ -34,18 +34,19 @@ def add_new_entries(docs_dir, out, git):
|
|||||||
timestamp = check_output([git, "log", "--format=%ct", "-n", "1", "--",
|
timestamp = check_output([git, "log", "--format=%ct", "-n", "1", "--",
|
||||||
f], encoding="UTF-8")
|
f], encoding="UTF-8")
|
||||||
if timestamp:
|
if timestamp:
|
||||||
files.append((f, timestamp))
|
content = f.read_text()
|
||||||
|
files.append(content)
|
||||||
else:
|
else:
|
||||||
print(f"Skipping file not tracked by git: {f.name}")
|
print(f"Skipping file not tracked by git: {f.name}")
|
||||||
|
|
||||||
files.sort(key=lambda x: x[1])
|
# Sort the changes by "severity", which roughly corresponds to
|
||||||
for file in files:
|
# alphabetical order by accident (e.g. remove > deprecate > change > add)
|
||||||
with open(file[0].resolve(), "r") as f:
|
for file in reversed(sorted(files)):
|
||||||
for line in f:
|
for line in file.splitlines():
|
||||||
line = textwrap.fill(line.rstrip(), width=80,
|
line = textwrap.fill(line.rstrip(), width=80,
|
||||||
initial_indent=" - ",
|
initial_indent=" - ",
|
||||||
subsequent_indent=" ")
|
subsequent_indent=" ")
|
||||||
out.write(line + "\n")
|
out.write(line + "\n")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
|
Loading…
Reference in New Issue
Block a user