Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release 0.13.0 (unreleased)
* Fix directory hash being non-deterministic across filesystem traversal orders, causing false local-change detection (#1058)
* Fix ``dfetch freeze`` not capturing branch information for SVN projects when only the revision matched (#1058)
* Rename child-manifests to sub-manifests in documentation and code (#1027)
* Fix missing closing quote in unfetched-project diagnostic command example (#1070)
* Fetch git submodules in git subproject at pinned revision (#1013)
* Add nested projects in subprojects to project report (#1017)
* Make ``dfetch report`` output more yaml-like (#1017)
Expand Down
22 changes: 22 additions & 0 deletions dfetch/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from contextlib import nullcontext
from typing import Any, cast

from rich._log_render import LogRender # type: ignore[import-untyped]
from rich.console import Console
from rich.highlighter import NullHighlighter
from rich.logging import RichHandler
Expand All @@ -16,6 +17,16 @@
from dfetch import __version__


class _NoExpandLogRender(LogRender): # pylint: disable=too-few-public-methods
"""LogRender that disables table expansion to prevent blank lines in asciicasts."""

def __call__(self, *args: Any, **kwargs: Any) -> Any:
"""Render log entry without expanding the table to the full terminal width."""
table = super().__call__(*args, **kwargs)
table.expand = False
return table


def make_console(no_color: bool = False) -> Console:
"""Create a Rich Console with proper color handling."""
return Console(
Expand All @@ -39,6 +50,17 @@ def configure_root_logger(console: Console | None = None) -> None:
highlighter=NullHighlighter(),
)

if os.getenv("ASCIINEMA_REC"):
# Rich's LogRender uses expand=True on its Table.grid, which pads every
# log message with trailing spaces to fill the full terminal width. When
# asciinema records the output the padded line fills the terminal exactly,
# causing the subsequent newline to produce a blank line in the cast
# player. Wrapping _log_render so it returns a non-expanding table
# removes the trailing spaces and avoids the spurious blank lines.
handler._log_render = _NoExpandLogRender( # pylint: disable=protected-access
show_time=False, show_level=False, show_path=False
)

logging.basicConfig(
level=logging.INFO,
format="%(message)s",
Expand Down
4 changes: 1 addition & 3 deletions dfetch/project/archivesubproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

from __future__ import annotations

import http.client
import os
import pathlib
import tempfile
Expand Down Expand Up @@ -98,8 +97,7 @@ def revision_is_enough() -> bool:

@staticmethod
def list_tool_info() -> None:
"""Log information about the archive fetching tool (Python's http.client)."""
SubProject._log_tool("http.client", http.client.__doc__ or "built-in")
"""No external tool info to report; archive fetching uses Python stdlib only."""

def get_default_branch(self) -> str:
"""Archives have no branches; return an empty string."""
Expand Down
2 changes: 1 addition & 1 deletion dfetch/reporting/check/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def unfetched_project(
message=f"{project.name} was never fetched!",
description=(
f"The manifest requires version '{str(wanted_version) or 'latest'}' of {project.name}. "
f"it was never fetched, fetch it with 'dfetch update {project.name}. "
f"it was never fetched, fetch it with 'dfetch update {project.name}'. "
f"The latest version available is '{latest}'"
),
)
Expand Down
333 changes: 167 additions & 166 deletions doc/asciicasts/basic.cast

Large diffs are not rendered by default.

248 changes: 122 additions & 126 deletions doc/asciicasts/check-ci.cast

Large diffs are not rendered by default.

117 changes: 59 additions & 58 deletions doc/asciicasts/check.cast
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
{"version": 2, "width": 189, "height": 16, "timestamp": 1771874631, "env": {"SHELL": "/bin/sh", "TERM": "xterm-256color"}}
[0.574293, "o", "\u001b[H\u001b[2J\u001b[3J"]
[0.578903, "o", "$ "]
[1.581453, "o", "\u001b"]
[1.761718, "o", "[1"]
[1.851861, "o", "mc"]
[1.941988, "o", "at"]
[2.032132, "o", " "]
[2.122251, "o", "df"]
[2.212398, "o", "et"]
[2.302536, "o", "ch"]
[2.392666, "o", ".y"]
[2.482804, "o", "a"]
[2.663029, "o", "ml"]
[2.753178, "o", "\u001b["]
[2.843298, "o", "0m"]
[3.844931, "o", "\r\n"]
[3.847017, "o", "manifest:\r\n version: 0.0 # DFetch Module syntax version\r\n\r\n remotes: # declare common sources in one place\r\n - name: github\r\n url-base: https://github.com/\r\n\r\n projects:\r\n - name: cpputest\r\n dst: cpputest/src/ # Destination of this project (relative to this file)\r\n repo-path: cpputest/cpputest.git # Use default github remote\r\n tag: v3.4 # tag\r\n\r\n - name: jsmn # without destination, defaults to project name\r\n repo-path: zserge/jsmn.git # only repo-path is enough\r\n"]
[3.850369, "o", "$ "]
[4.852912, "o", "\u001b["]
[5.033192, "o", "1m"]
[5.123325, "o", "df"]
[5.213519, "o", "et"]
[5.303647, "o", "ch"]
[5.393763, "o", " c"]
[5.483892, "o", "he"]
[5.574023, "o", "ck"]
[5.664156, "o", "\u001b["]
[5.754272, "o", "0m"]
[6.755766, "o", "\r\n"]
[7.210689, "o", "\u001b[1;34mDfetch (0.12.1)\u001b[0m \r\n"]
[7.222157, "o", " \u001b[1;92mcpputest:\u001b[0m \r\n"]
[7.222433, "o", "\u001b[?25l"]
[7.303262, "o", "\u001b[32m⠋\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.383974, "o", "\r\u001b[2K\u001b[32m⠙\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.464541, "o", "\r\u001b[2K\u001b[32m⠹\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.51026, "o", "\r\u001b[2K\u001b[32m⠹\u001b[0m \u001b[1;94m> Checking\u001b[0m\r\n\u001b[?25h\r\u001b[1A\u001b[2K"]
[7.510833, "o", " \u001b[1;34m> wanted (v3.4), available (v4.0)\u001b[0m "]
[7.510913, "o", "\r\n"]
[7.5117, "o", " \u001b[1;92mjsmn:\u001b[0m \r\n"]
[7.511916, "o", "\u001b[?25l"]
[7.59245, "o", "\u001b[32m⠋\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.672944, "o", "\r\u001b[2K\u001b[32m⠙\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.753704, "o", "\r\u001b[2K\u001b[32m⠹\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.834197, "o", "\r\u001b[2K\u001b[32m⠸\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.915841, "o", "\r\u001b[2K\u001b[32m⠼\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.996532, "o", "\r\u001b[2K\u001b[32m⠴\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[8.071979, "o", "\r\u001b[2K\u001b[32m⠴\u001b[0m \u001b[1;94m> Checking\u001b[0m\r\n\u001b[?25h\r\u001b[1A\u001b[2K"]
[8.073593, "o", " \u001b[1;34m> available (master - 25647e692c7906b96ffd2b05ca54c097948e879c)\u001b[0m "]
[8.073671, "o", "\r\n"]
[11.14227, "o", "$ "]
[11.143678, "o", "\u001b"]
[11.323862, "o", "[1"]
[11.413988, "o", "m\u001b"]
[11.504174, "o", "[0"]
[11.594296, "o", "m"]
[11.594825, "o", "\r\n"]
[11.596694, "o", "/workspaces/dfetch/doc/generate-casts\r\n"]
{"version": 2, "width": 165, "height": 30, "timestamp": 1774247111, "env": {"SHELL": "/bin/sh", "TERM": "xterm-256color"}}
[0.66465, "o", "\u001b[H\u001b[2J\u001b[3J"]
[0.668498, "o", "$ "]
[1.671618, "o", "\u001b"]
[1.852983, "o", "[1"]
[1.94317, "o", "mc"]
[2.034404, "o", "at"]
[2.124541, "o", " "]
[2.214675, "o", "df"]
[2.30482, "o", "et"]
[2.394943, "o", "ch"]
[2.485085, "o", ".y"]
[2.575257, "o", "a"]
[2.755682, "o", "ml"]
[2.845712, "o", "\u001b["]
[2.935834, "o", "0m"]
[3.937415, "o", "\r\n"]
[3.940467, "o", "manifest:\r\n version: 0.0 # DFetch Module syntax version\r\n\r\n remotes: # declare common sources in one place\r\n - name: github\r\n url-base: https://github.com/\r\n\r\n projects:\r\n - name: cpputest\r\n dst: cpputest/src/ # Destination of this project (relative to this file)\r\n repo-path: cpputest/cpputest.git # Use default github remote\r\n tag: v3.4 # tag\r\n\r\n - name: jsmn # without destination, defaults to project name\r\n repo-path: zserge/jsmn.git # only repo-path is enough\r\n"]
[3.945503, "o", "$ "]
[4.948613, "o", "\u001b"]
[5.129105, "o", "[1"]
[5.219231, "o", "md"]
[5.309371, "o", "fe"]
[5.399529, "o", "t"]
[5.49124, "o", "ch"]
[5.581308, "o", " c"]
[5.671443, "o", "he"]
[5.761584, "o", "ck"]
[5.851713, "o", "\u001b"]
[6.031978, "o", "[0"]
[6.122457, "o", "m"]
[7.12417, "o", "\r\n"]
[7.617044, "o", "\u001b[1;34mDfetch (0.12.1)\u001b[0m\r\n"]
[7.630225, "o", " \u001b[1;92mcpputest:\u001b[0m\r\n"]
[7.63045, "o", "\u001b[?25l"]
[7.715034, "o", "\u001b[32m⠋\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.795646, "o", "\r\u001b[2K\u001b[32m⠙\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.87624, "o", "\r\u001b[2K\u001b[32m⠹\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[7.914558, "o", "\r\u001b[2K\u001b[32m⠹\u001b[0m \u001b[1;94m> Checking\u001b[0m\r\n\u001b[?25h\r\u001b[1A\u001b[2K"]
[7.915386, "o", " \u001b[1;34m> wanted (v3.4), available (v4.0)\u001b[0m\r\n"]
[7.916246, "o", " \u001b[1;92mjsmn:\u001b[0m\r\n"]
[7.91638, "o", "\u001b[?25l"]
[7.99715, "o", "\u001b[32m⠋\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[8.077644, "o", "\r\u001b[2K\u001b[32m⠙\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[8.158245, "o", "\r\u001b[2K\u001b[32m⠹\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[8.238823, "o", "\r\u001b[2K\u001b[32m⠸\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[8.319411, "o", "\r\u001b[2K\u001b[32m⠼\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[8.400061, "o", "\r\u001b[2K\u001b[32m⠴\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[8.460435, "o", "\r\u001b[2K\u001b[32m⠴\u001b[0m \u001b[1;94m> Checking\u001b[0m"]
[8.461023, "o", "\r\n\u001b[?25h\r\u001b[1A\u001b[2K"]
[8.462981, "o", " \u001b[1;34m> available (master - 25647e692c7906b96ffd2b05ca54c097948e879c)\u001b[0m\r\n"]
[11.528152, "o", "$ "]
[11.53011, "o", "\u001b"]
[11.710398, "o", "[1"]
[11.800546, "o", "m\u001b"]
[11.890677, "o", "[0"]
[11.980814, "o", "m"]
[11.981405, "o", "\r\n"]
[11.984299, "o", "/workspaces/dfetch/doc/generate-casts\r\n"]
Loading
Loading