Various improvements
This commit is contained in:
parent
874d2b4aeb
commit
bbb671158d
1 changed files with 53 additions and 19 deletions
44
todo
44
todo
|
|
@ -222,8 +222,26 @@ def normalize_upstream_version(version: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
def print_changes(old_list: TodoList, new_list: TodoList) -> None:
|
def print_changes(old_list: TodoList, new_list: TodoList) -> None:
|
||||||
old_sources = summarize_sources(old_list)
|
def format_details(details: str) -> str:
|
||||||
new_sources = summarize_sources(new_list)
|
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)
|
added = sorted(new_sources - old_sources)
|
||||||
removed = sorted(old_sources - new_sources)
|
removed = sorted(old_sources - new_sources)
|
||||||
if not added and not removed:
|
if not added and not removed:
|
||||||
|
|
@ -232,11 +250,11 @@ def print_changes(old_list: TodoList, new_list: TodoList) -> None:
|
||||||
if added:
|
if added:
|
||||||
print("New packages:")
|
print("New packages:")
|
||||||
for source in added:
|
for source in added:
|
||||||
print(f" {source}")
|
print(f" {source} - {new_details.get(source, '-')}")
|
||||||
if removed:
|
if removed:
|
||||||
print("Removed packages:")
|
print("Removed packages:")
|
||||||
for source in removed:
|
for source in removed:
|
||||||
print(f" {source}")
|
print(f" {source} - {old_details.get(source, '-')}")
|
||||||
|
|
||||||
|
|
||||||
def list_todos(include_prerelease: bool) -> None:
|
def list_todos(include_prerelease: bool) -> None:
|
||||||
|
|
@ -246,6 +264,11 @@ def list_todos(include_prerelease: bool) -> None:
|
||||||
source_info_map = load_source_info_map()
|
source_info_map = load_source_info_map()
|
||||||
notes_by_source = load_notes()
|
notes_by_source = load_notes()
|
||||||
console = Console()
|
console = Console()
|
||||||
|
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 = Table(title="Debian New Upstream TODOs")
|
||||||
table.add_column("Source", style="bold")
|
table.add_column("Source", style="bold")
|
||||||
table.add_column("New", style="green", justify="right")
|
table.add_column("New", style="green", justify="right")
|
||||||
|
|
@ -253,7 +276,6 @@ def list_todos(include_prerelease: bool) -> None:
|
||||||
table.add_column("Team", justify="right")
|
table.add_column("Team", justify="right")
|
||||||
table.add_column("Note/Uploaders", overflow="fold")
|
table.add_column("Note/Uploaders", overflow="fold")
|
||||||
|
|
||||||
filtered = filter_todo_list(todo_list, include_prerelease=include_prerelease)
|
|
||||||
for todo in filtered:
|
for todo in filtered:
|
||||||
new_version, current_version = parse_details(todo[":details"])
|
new_version, current_version = parse_details(todo[":details"])
|
||||||
source_info = source_info_map.get(todo[":source"], {})
|
source_info = source_info_map.get(todo[":source"], {})
|
||||||
|
|
@ -270,6 +292,17 @@ def list_todos(include_prerelease: bool) -> None:
|
||||||
elif display_team.endswith("-team"):
|
elif display_team.endswith("-team"):
|
||||||
display_team = display_team[:-5]
|
display_team = display_team[:-5]
|
||||||
display_note = note or uploaders or "-"
|
display_note = note or uploaders or "-"
|
||||||
|
|
||||||
|
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(
|
table.add_row(
|
||||||
source,
|
source,
|
||||||
display_new,
|
display_new,
|
||||||
|
|
@ -277,6 +310,7 @@ def list_todos(include_prerelease: bool) -> None:
|
||||||
display_team,
|
display_team,
|
||||||
display_note,
|
display_note,
|
||||||
)
|
)
|
||||||
|
if not is_narrow:
|
||||||
console.print(table)
|
console.print(table)
|
||||||
console.print(f"Packages: {len(filtered)}")
|
console.print(f"Packages: {len(filtered)}")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue