Various improvements

This commit is contained in:
Edward Betts 2026-02-01 13:20:45 +00:00
parent 874d2b4aeb
commit bbb671158d

72
todo
View file

@ -222,8 +222,26 @@ def normalize_upstream_version(version: str) -> str:
def print_changes(old_list: TodoList, new_list: TodoList) -> None:
old_sources = summarize_sources(old_list)
new_sources = summarize_sources(new_list)
def format_details(details: str) -> str:
new_version, current_version = parse_details(details)
display_new = new_version
if is_prerelease_version(details):
display_new = f"{new_version} (pre)"
return f"New: {display_new} | Current: {current_version or '-'}"
def build_details(todo_list: TodoList) -> dict[str, str]:
details_by_source: dict[str, str] = {}
for item in todo_list:
source = item.get(":source")
details = item.get(":details")
if isinstance(source, str) and isinstance(details, str):
details_by_source[source] = format_details(details)
return details_by_source
old_details = build_details(old_list)
new_details = build_details(new_list)
old_sources = set(old_details)
new_sources = set(new_details)
added = sorted(new_sources - old_sources)
removed = sorted(old_sources - new_sources)
if not added and not removed:
@ -232,11 +250,11 @@ def print_changes(old_list: TodoList, new_list: TodoList) -> None:
if added:
print("New packages:")
for source in added:
print(f" {source}")
print(f" {source} - {new_details.get(source, '-')}")
if removed:
print("Removed packages:")
for source in removed:
print(f" {source}")
print(f" {source} - {old_details.get(source, '-')}")
def list_todos(include_prerelease: bool) -> None:
@ -246,14 +264,18 @@ def list_todos(include_prerelease: bool) -> None:
source_info_map = load_source_info_map()
notes_by_source = load_notes()
console = Console()
table = Table(title="Debian New Upstream TODOs")
table.add_column("Source", style="bold")
table.add_column("New", style="green", justify="right")
table.add_column("Current", style="dim", justify="right")
table.add_column("Team", justify="right")
table.add_column("Note/Uploaders", overflow="fold")
filtered = filter_todo_list(todo_list, include_prerelease=include_prerelease)
is_narrow = console.width < 100
if is_narrow:
console.print("Debian New Upstream TODOs")
else:
table = Table(title="Debian New Upstream TODOs")
table.add_column("Source", style="bold")
table.add_column("New", style="green", justify="right")
table.add_column("Current", style="dim", justify="right")
table.add_column("Team", justify="right")
table.add_column("Note/Uploaders", overflow="fold")
for todo in filtered:
new_version, current_version = parse_details(todo[":details"])
source_info = source_info_map.get(todo[":source"], {})
@ -270,14 +292,26 @@ def list_todos(include_prerelease: bool) -> None:
elif display_team.endswith("-team"):
display_team = display_team[:-5]
display_note = note or uploaders or "-"
table.add_row(
source,
display_new,
current_version or "-",
display_team,
display_note,
)
console.print(table)
if is_narrow:
parts = [f"[bold]{source}[/bold]"]
if display_team != "-":
parts.append(f"[dim]{display_team}[/dim]")
parts.append(f"N: {display_new}")
parts.append(f"C: {current_version or '-'}")
console.print(" ".join(parts))
if display_note != "-":
console.print(" " + display_note)
else:
table.add_row(
source,
display_new,
current_version or "-",
display_team,
display_note,
)
if not is_narrow:
console.print(table)
console.print(f"Packages: {len(filtered)}")
def update_todos() -> None: